public void ShuffleList(List <int> lis) //Shuffle supplied int list { int j = lis.Count; while (j > 1) { j--; int k = SysRand.Next(j + 1); int temp = lis[k]; lis[k] = lis[j]; lis[j] = temp; } }
public void ShuffleArray(int[] arr) //Shuffle supplied int array { int j = arr.Length; while (j > 1) { j--; int k = SysRand.Next(j + 1); int temp = arr[k]; arr[k] = arr[j]; arr[j] = temp; } }
public void CountAndShuffleArray(int[] arr) //Populate array with ascending numbers, then shuffle { for (int i = 0; i < arr.Length; i++) { arr[i] = i; } int j = arr.Length; while (j > 1) { j--; int k = SysRand.Next(j + 1); int temp = arr[k]; arr[k] = arr[j]; arr[j] = temp; } }