Generating random numbers without repitiion

Hello all,
How can I generate, say 10, random numbers uniformly distributed between Nmin and Nmax, without repeating any one of them twice?
Thanks

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 5월 29일
편집: Azzi Abdelmalek 2014년 5월 29일

1 개 추천

Nmin+rand(1,10)*(Nmax-Nmin)

댓글 수: 1

S. David
S. David 2014년 5월 29일
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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Random Number Generation에 대해 자세히 알아보기

질문:

2014년 5월 29일

댓글:

2014년 5월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by