필터 지우기
필터 지우기

Generating random numbers without repitiion

조회 수: 2 (최근 30일)
S. David
S. David 2014년 5월 29일
댓글: S. David 2014년 5월 29일
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일
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개)

카테고리

Help CenterFile Exchange에서 Random Number Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by