12.2.1 Random permutations
The
randperm
or
shuffle
command computes a random permutation.
randperm
takes
n
, an integer.
randperm(
n
)
returns a random permutation of [0,1,…,
n
−1].
Example
randperm
(3)
⎡
⎣
2,0,1
⎤
⎦