MATLAB: Specified numbers of random permutation of a vector

randperm

randperm(n) returns a row vector containing a random permutation of the integers from 1 to n inclusive but I need random permutation of the integers from a vector, also I don't need all off them just specified number e.g. 100.

Best Answer

I did it by myself as below:
for k=1:MatSize
ind=randperm(numel(vec));
Mat(k,:)=vec(ind);
end