Switched RNG

This commit is contained in:
Toastie (DCS Team) 2024-10-29 23:12:51 +13:00
parent 55029de233
commit 3e66a5659d
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4

View file

@ -1,6 +1,7 @@
using System;
using System.Linq;
using System.Collections.Generic;
using System.Security.Cryptography;
using DSharpPlus;
using MySqlConnector;
@ -10,8 +11,6 @@ public static class Database
{
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)
{
connectionString = "server=" + host +
@ -455,7 +454,7 @@ public static class Database
public static StaffMember GetRandomActiveStaff(params ulong[] 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)