Getting a random list of numbers on a very specific interval
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Evan Bakalars
il 25 Feb 2021
Modificato: James Tursa
il 25 Feb 2021
How would I go about getting a list of 10000 random numbers (using rng('shuffle')), between 0 and 90, but does not include any numbers between 40 and 50. I dont want to split it by saying give 5000 random numbers from 0-40 and 5000 for 50-90.
0 Commenti
Risposta accettata
James Tursa
il 25 Feb 2021
Modificato: James Tursa
il 25 Feb 2021
Generate the list according to the range width of valid values, then adjust the results. E.g.,
r = rand(10000,1)*80;
ix = r > 40;
r(ix) = r(ix) + 10;
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Random Number Generation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!