Random number within a decimal range
2 次查看(过去 30 天)
显示 更早的评论
How do I create a random number within the range 0.95 to 0.99? Any help is appreciated. Thanks in advance.
0 个评论
采纳的回答
Salaheddin Hosseinzadeh
2014-9-14
编辑:Salaheddin Hosseinzadeh
2014-9-14
Hi Akif,
This is exactly a copy paste from MATLAB's help, so for further info type
doc rand
Your solution
r = a + (b-a).*rand(100,1);
Be aware, rand is generates evenly distributed random randi is the same but integer, But randn generates normally distributed random (gaussian distribution)
Good Luck!
2 个评论
Image Analyst
2014-9-14
And there's also a randi() that generates integers, though they're actually of class double, not an integer class, though they are rounded (no fraction).
更多回答(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!