MATLAB: How to create non-repetitive random integers

non-repetitive random integers

Hi,
As the title suggests I want to create non-repetitive random integers but don't know how to… say 70 integers ranging from 1 to 100. is there a straight way to do this?
thanks,

Best Answer

Try this code:
N = 100;
x = randperm(N);
x = x(1:70)