using the mod function to create and even random number generator in matlab
显示 更早的评论
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?
Alex Perez
2020-1-27
回答(1 个)
John D'Errico
2020-1-27
0 个投票
Why do you need the mod function? Just generate random integers, and then MULTIPLY THEM BY 2.
类别
在 帮助中心 和 File Exchange 中查找有关 Random Number Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
