Generating random numbers without repitiion

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

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 29 May 2014
Edited: Azzi Abdelmalek on 29 May 2014
Nmin+rand(1,10)*(Nmax-Nmin)
  1 Comment
S. David
S. David on 29 May 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

Sign in to comment.

More Answers (0)

Categories

Find more on Random Number Generation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by