how to create random double in specific range?
显示 更早的评论
HI, randi function Can only generate integers in specific range.
num = randi([1,3],[1,10],'double');
how to create double numbers in range such as [0.2,1.2]?
采纳的回答
更多回答(1 个)
Carolina Escobar
2023-4-1
0 个投票
e = rand(0.1,1)
1 个评论
This will throw an error.
e = rand(0.1, 1)
As the error message indicates, the size inputs to rand must contain integer values.
类别
在 帮助中心 和 File Exchange 中查找有关 Random Number Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!