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:
Kwoth
2023-11-11 05:22:52 +00:00
parent a28be0d343
commit bc77783820
224 changed files with 308 additions and 317 deletions

View File

@@ -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];
}
}