Hello every one, How can I generate randomly only one number between two values (e.g.: 0.01-1)each time?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
ARAM KHURSHEED
el 22 de En. de 2022
Comentada: ARAM KHURSHEED
el 23 de En. de 2022
a=ran(0.2,1.12)
b= ran(0.01,0.1)
function T = ran(min,max)
T= fix((max-min).*rand(1,1) + min)+1;
end
This code doesn't give me real number, It just give only integer number.
for example i want give me for a= 0.5 or 1.11 or any real number, and same for b=0.02 or 0.06 and so on.
i have use this code in this code: new{'LTE','Jitter'}=ran(0.6,4);
Thank you in advanced
0 comentarios
Respuesta aceptada
Walter Roberson
el 22 de En. de 2022
Remove the fix() call. fix() asks to take the integer portion of the value (rounding towards 0)
4 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Tables 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!