mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-12 18:28:27 -04:00
Updated some namespaces, finished some todos. v5 should be cancelled probably as the code is too intertwined to make it modular
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
namespace Nadeko.Common;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace Nadeko.Common;
|
||||
|
||||
// made for expressions because they almost never get added
|
||||
// and they get looped through constantly
|
||||
@@ -48,4 +50,13 @@ public static class ArrayExtensions
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public static T? RandomOrDefault<T>(this T[] data)
|
||||
{
|
||||
if (data.Length == 0)
|
||||
return default;
|
||||
|
||||
var index = RandomNumberGenerator.GetInt32(0, data.Length);
|
||||
return data[index];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user