1 | initial version |
In C#, you can permute a list of arrays by using the Fisher-Yates shuffle algorithm. Here is an example implementation of the algorithm:
#
public static void ShuffleList(List<int[]> list)
{
Random random = new Random();
int n = list.Count;
while (n > 1) {
n--;
int k = random.Next(n + 1);
int[] value = list[k];
list[k] = list[n];
list[n] = value;
}
}
This code shuffles the list by swapping each element with a random element that comes after it. To use this method, simply pass a list of integer arrays to the ShuffleList
function.