Filter löschen
Filter löschen

Generating random numbers without repitiion

2 Ansichten (letzte 30 Tage)
S. David
S. David am 29 Mai 2014
Kommentiert: S. David am 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

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 29 Mai 2014
Bearbeitet: Azzi Abdelmalek am 29 Mai 2014
Nmin+rand(1,10)*(Nmax-Nmin)
  1 Kommentar
S. David
S. David am 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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Random Number Generation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by