RANDPERM Random permutation

Section: Random Number Generation

USAGE

   y = randperm(n)

y is a random permutation of integers from 1 to n. randperm calls rand and changes its state.

Example

--> y = randperm(10)

y = 
  4  9  6  3 10  7  2  8  1  5