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!