Generating random numbers without repitiion

5 visualizaciones (últimos 30 días)
S. David
S. David el 29 de Mayo de 2014
Comentada: S. David el 29 de Mayo de 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

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 29 de Mayo de 2014
Editada: Azzi Abdelmalek el 29 de Mayo de 2014
Nmin+rand(1,10)*(Nmax-Nmin)
  1 comentario
S. David
S. David el 29 de Mayo de 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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Random Number Generation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by