using the mod function to create and even random number generator in matlab
28 次查看(过去 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!