public static void RandSortArray(List<int> arr) { int size = arr.Count; int seed = 10000; //对给定数组随机排序, 每组排列的概率都为 1/size的阶乘 System.Random rand = new System.Random(); for (int i = 0; i < size; i++) { int randIndex = (int)(rand.Next(seed) % (size - i)) + i;//产生一个[i, size-1]的随机数 int j = arr[i]; arr[i] = arr[randIndex]; arr[randIndex] = j; } }