generate random numbers outside a range
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Omar Hammouda
am 16 Feb. 2017
Kommentiert: Omar Hammouda
am 16 Feb. 2017
How can I generate random numbers outside a specific range? I want to generate random numbers outside the interval of [-1,3]
2 Kommentare
Adam
am 16 Feb. 2017
Up to what bounds? Generating unbounded random numbers is somewhat problematic.
Akzeptierte Antwort
KSSV
am 16 Feb. 2017
a = -10;
b = 10;
r = (b-a).*rand(1000,1) + a;
%%remove the range [-1 3]
r1 = r ;
r1(r>=-1 & r<=3) = [];
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Random Number Generation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!