using the mod function to create and even random number generator in matlab
30 ビュー (過去 30 日間)
古いコメントを表示
using the vector i created called random20
random20 = randi ([0,100],1,20);
how do i use the mod function to get all even random integers
any help would be appreciated.
2 件のコメント
James Tursa
2020 年 1 月 27 日
編集済み: James Tursa
2020 年 1 月 27 日
Hint: What does mod(random20,2) give you? Can you use that to get the even ones?
回答 (1 件)
John D'Errico
2020 年 1 月 27 日
Why do you need the mod function? Just generate random integers, and then MULTIPLY THEM BY 2.
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!