Switched RNG
This commit is contained in:
parent
55029de233
commit
3e66a5659d
1 changed files with 2 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Security.Cryptography;
|
||||||
using DSharpPlus;
|
using DSharpPlus;
|
||||||
using MySqlConnector;
|
using MySqlConnector;
|
||||||
|
|
||||||
|
@ -10,8 +11,6 @@ public static class Database
|
||||||
{
|
{
|
||||||
private static string connectionString = "";
|
private static string connectionString = "";
|
||||||
|
|
||||||
private static readonly Random random = new Random();
|
|
||||||
|
|
||||||
public static void SetConnectionString(string host, int port, string database, string username, string password)
|
public static void SetConnectionString(string host, int port, string database, string username, string password)
|
||||||
{
|
{
|
||||||
connectionString = "server=" + host +
|
connectionString = "server=" + host +
|
||||||
|
@ -455,7 +454,7 @@ public static class Database
|
||||||
public static StaffMember GetRandomActiveStaff(params ulong[] ignoredUserIDs)
|
public static StaffMember GetRandomActiveStaff(params ulong[] ignoredUserIDs)
|
||||||
{
|
{
|
||||||
List<StaffMember> staffMembers = GetActiveStaff(ignoredUserIDs);
|
List<StaffMember> staffMembers = GetActiveStaff(ignoredUserIDs);
|
||||||
return staffMembers.Any() ? staffMembers[random.Next(staffMembers.Count)] : null;
|
return staffMembers.Any() ? staffMembers[RandomNumberGenerator.GetInt32(staffMembers.Count)] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<StaffMember> GetActiveStaff(params ulong[] ignoredUserIDs)
|
public static List<StaffMember> GetActiveStaff(params ulong[] ignoredUserIDs)
|
||||||
|
|
Loading…
Reference in a new issue