Generating random numbers without repitiion

2 vues (au cours des 30 derniers jours)
S. David
S. David le 29 Mai 2014
Commenté : S. David le 29 Mai 2014
Hello all,
How can I generate, say 10, random numbers uniformly distributed between Nmin and Nmax, without repeating any one of them twice?
Thanks

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 29 Mai 2014
Modifié(e) : Azzi Abdelmalek le 29 Mai 2014
Nmin+rand(1,10)*(Nmax-Nmin)
  1 commentaire
S. David
S. David le 29 Mai 2014
It works. I was using unifrnd, and it was giving me the same number more than once. It seems that rand generates more randomness.
Thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by