Advanced use of randi(x) and other random number generating functions
Afficher commentaires plus anciens
Is it possible to get the randi(x) function to work with a specifically chosen set of numbers, such as 1 through 9 except 6?
From what I can tell, the function description doesn't make it seem possible. Is there a creative way around this? What about using other random number generating functions?
Réponse acceptée
Plus de réponses (1)
Azzi Abdelmalek
le 18 Avr 2014
your_range=[1:5 7:9]
[~,ii]=sort(rand(1,numel(your_range)))
out=your_range(ii)
1 commentaire
David
le 30 Avr 2014
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!