mirror of
https://github.com/whoswhip/Spectrum.git
synced 2026-12-06 01:28:42 +00:00
refactor: use Random.Shared for permutation generation
This commit is contained in:
@@ -315,12 +315,9 @@ namespace Spectrum.Input
|
||||
{
|
||||
int[] perm = new int[256];
|
||||
for (int i = 0; i < 256; i++) perm[i] = i;
|
||||
string user = Environment.UserName;
|
||||
int seed = Environment.TickCount + user.GetHashCode();
|
||||
Random rand = new(seed);
|
||||
for (int i = 255; i > 0; i--)
|
||||
{
|
||||
int j = rand.Next(i + 1);
|
||||
int j = Random.Shared.Next(i + 1);
|
||||
(perm[i], perm[j]) = (perm[j], perm[i]);
|
||||
}
|
||||
return perm;
|
||||
|
||||
Reference in New Issue
Block a user