📅  最后修改于: 2022-03-11 14:48:42.691000             🧑  作者: Mango
public class Randomizer
{
public static void Randomize(T[] items)
{
Random rand = new Random();
// For each spot in the array, pick
// a random item to swap into that spot.
for (int i = 0; i < items.Length - 1; i++)
{
int j = rand.Next(i, items.Length);
T temp = items[i];
items[i] = items[j];
items[j] = temp;
}
}
}