using the mod function to create and even random number generator in matlab
28 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
James Tursa
le 27 Jan 2020
Modifié(e) : James Tursa
le 27 Jan 2020
Hint: What does mod(random20,2) give you? Can you use that to get the even ones?
Réponses (1)
John D'Errico
le 27 Jan 2020
Why do you need the mod function? Just generate random integers, and then MULTIPLY THEM BY 2.
0 commentaires
Voir également
Catégories
En savoir plus sur Random Number Generation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!