Hello every one, How can I generate randomly only one number between two values (e.g.: 0.01-1)each time?
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Walter Roberson
2022 年 1 月 22 日
Remove the fix() call. fix() asks to take the integer portion of the value (rounding towards 0)
4 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Tables についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!