How i can insert a random integer between two numbers?
显示 更早的评论
I have a variable and i want it to take a randome integer between numbers 2 and 101
回答(2 个)
Thomas Koelen
2015-4-22
编辑:Thomas Koelen
2015-4-22
a=uint16(2+rand*99)
Star Strider
2015-4-22
The randi function is perfect for this:
rv = randi([2 101]);
类别
在 帮助中心 和 File Exchange 中查找有关 Random Number Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!