random permutation with repetition for > 2000 elements

조회 수: 1 (최근 30일)
Claudia
Claudia 2013년 12월 1일
편집: Claudia 2013년 12월 1일
Hi
randperm is for permutations WITHOUT repetition. I would need it WITH repetition. I could calculate all permutations (I found some scripts), but I need it for vectors with more than 2000 elements. Any ideas?
Thanks so much
Claudia

채택된 답변

Image Analyst
Image Analyst 2013년 12월 1일
Try this
randomNumbers = randi(highestNumber, rows, columns);
plug in whatever values you want, for example:
randomNumbers = randi(9, 1, 2000); % 2000 numbers in the range 1-9.
  댓글 수: 1
Claudia
Claudia 2013년 12월 1일
편집: Claudia 2013년 12월 1일
Perfect! I have seen randi but must have been 'blind' as I did not realize that this is exactly what I am looking for. Thanks so much for your fast help! Cheers

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Elementary Math에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by