random numbers can be divided b
1 回表示 (過去 30 日間)
古いコメントを表示
hello,
how can i generate random numbers within a range that all generated numbers can be divided by 5??
meaning:
random number = r
r%5 = 0
regards
0 件のコメント
採用された回答
Star Strider
2019 年 6 月 15 日
Try this:
r5 = randi(10,1,20)*5; % Creates 20 Random Integers From 5 To 50, All Of Which Can Be Divided Evenly By 5
Test = rem(r5,5)
The ‘Test’ vector will have elements only equal to 0.
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!