randperm

randperm(n) returns a row vector containing a random permutation of integers in the set 1:n.

Examples

>> rng(0) 

% for tractability

randperm(5)# 1 2 5 3 4

See also

rand | randi | randsample | rng