I am looking for an efficient way of doing randperm(n,k) many successive times with the same n and k. Can anyone propose something more efficient than the obvious for-loop approach below?
M=1e5; n=100; k=10; A=nan(k,M); for i=1:M A(:,i) = randperm(n,k).'; end
Best Answer