Reputation: 52
I have generated random numbers in MATLAB within a range using the below:
N=10000;
n=3000;
c=randperm(N,n);
I need another set of random numbers within the same range 1:N
and of the same size n
but excluding the values in c
.
Any ideas?
Upvotes: 0
Views: 719
Reputation: 602
You can use again randperm
excluding the integers of array c
to crate array d
with same length n
:
ok = 1:N;
ok(c) = [];
d=ok(randperm(numel(ok),n));
Upvotes: 4