Question about random numbers and rejecting
Afficher commentaires plus anciens
Hi there, I'm new to matlab. I'm trying to make a function, where you input a,b, and c generates a random integer from a to b and the function rejects the c value. I tried
function r =randnum_reject(a,b,c)
r=randi([a,b]);
if r==c
?????
end
end
I don't know what to do after the if statement. Any help? Thanks EXAMPLE: Like say I type randnum_reject(1,10,2), and my function will output a random number from 1 to 10, but NOT 2.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Random Number Generation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!