Hi all,

From what I see, Matlab uses

======

p = randperm(n)
p = randperm(n,k)

Description
p = randperm(n) returns a row vector containing a random permutation of the integers from 1 to n inclusive.

p = randperm(n,k) returns a row vector containing k unique integers selected randomly from 1 to n inclusive.

======
to create an index of integers that can be used then to select/permute the columns (or rows) of a matrix
 

Yiannis