generate random numbers outside a range
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Omar Hammouda
el 16 de Feb. de 2017
Comentada: Omar Hammouda
el 16 de Feb. de 2017
How can I generate random numbers outside a specific range? I want to generate random numbers outside the interval of [-1,3]
2 comentarios
Adam
el 16 de Feb. de 2017
Up to what bounds? Generating unbounded random numbers is somewhat problematic.
Respuesta aceptada
KSSV
el 16 de Feb. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Random Number Generation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!