p = randperm(n)
p = randperm(n) is a random permutation of the integers 1:n.
randperm(6) might be the vector
[3 2 6 4 1 5]
or it might be some other permutation of 1:6.
rand,sprandn
(c) Copyright 1994 by The MathWorks, Inc.