Azzera filtri
Azzera filtri

Generating random numbers without repitiion

2 visualizzazioni (ultimi 30 giorni)
Hello all,
How can I generate, say 10, random numbers uniformly distributed between Nmin and Nmax, without repeating any one of them twice?
Thanks

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 29 Mag 2014
Modificato: Azzi Abdelmalek il 29 Mag 2014
Nmin+rand(1,10)*(Nmax-Nmin)
  1 Commento
S. David
S. David il 29 Mag 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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Random Number Generation in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by