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.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-08-14 11:00:00 +0000
Seen: 16 times
Last updated: Jun 05 '21
Need a Function in Python to remove entries less than 2 digits from an Array
How can arrays with different numbers of rows be stacked on top of each other?
How can arrays be plotted chronologically over a period of time?
In certain scenarios, what is the process of combining two arrays that are already sorted?
How can you combine numerous arrays with lodash?
Is it possible for numpy bincount to function with arrays of two dimensions?