Previous Up Next

5.10.1  Random permutation: randperm, shuffle

randperm (or shuffle) takes as argument an integer n.
randperm returns a random permutation of [0..n−1].
Input:

randperm(3)

Output:

[2,0,1]

Previous Up Next