how can i generate a random number between two float numbers
74 次查看(过去 30 天)
显示 更早的评论
I am trying to generate a random number between two float numbers by using
val = randi([mnval mxval],1,1)
where mxval and mnval are two float numbers. when i run the above command "First input must be a positive scalar integer value IMAX, or two integer values [IMIN IMAX] with IMIN less than or equal to IMAX." error is coming.
0 个评论
采纳的回答
James Tursa
2018-9-12
This is one of the examples in the rand doc:
val = mnval + rand*(mxval-mnval);
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Random Number Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!