values of randi function repeat themselves
조회 수: 4 (최근 30일)
이전 댓글 표시
while using the function randi that generate random integers uniformly disterbuted i sometimes get in the output vector the same numbers for example:
4 2 5 3 4 8 7 9 7 4
(the number 4 was three times in the row above)
how can i avoid this?
locTX=randi([1 20],1,4);
댓글 수: 0
채택된 답변
Azzi Abdelmalek
2014년 8월 30일
편집: Azzi Abdelmalek
2014년 8월 30일
댓글 수: 4
Image Analyst
2014년 8월 31일
rand() and randi() are uniform. randn() is normally/Gaussian distributed. You might want to edit your post (body and subject line) to get rid of randni to avoid confusing people with a function that you say you don't use.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!