random permutation with repetition for > 2000 elements

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 日

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 件)

カテゴリ

ヘルプ センター および File ExchangeRandom Number Generation についてさらに検索

質問済み:

2013 年 12 月 1 日

編集済み:

2013 年 12 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by