Method Permutation
Permutation(int)
Generates a permutation of the integers from 0 to n-1.
Declaration
public static int[] Permutation(int n)
Parameters
Type | Name | Description |
---|---|---|
int | n | Size of the permutation array to generate |
Returns
Type | Description |
---|---|
int[] | Permutation array |
Remarks
Uses Knuth/Fisher-Yates shuffles: https://en.wikipedia.org/wiki/Random_permutation#Fisher-Yates_shuffles