Random numbers within 2 ranges
Mostra commenti meno recenti
Is it possible to generate random numbers within 2 ranges but for the same purpose.
e.g. from 1-100 & 200-300, with all the results output together?
Thanks
~N~
Risposte (2)
Azzi Abdelmalek
il 23 Feb 2013
Modificato: Azzi Abdelmalek
il 23 Feb 2013
[randi(100,1,100);randi(100,1,100)+199]
2 Commenti
Jan
il 24 Feb 2013
Then the upper range is from 200 to 299 only.
Azzi Abdelmalek
il 24 Feb 2013
Yes, it should be
randi(101,1,100)+199
Jan
il 24 Feb 2013
a = randi([1, 201], 1, 100)
a(a > 100) = a(a > 100) + 99;
Categorie
Scopri di più su Random Number Generation in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!