How do I create a set of random numbers with a given set of numbers? Using randi command.

2 ビュー (過去 30 日間)
This is my code,
a = [8 5 2 6 9 3 1 4 0 7];
randi(imax,n);
When I run it, there is an error, "Unrecognized function or variable 'imax' ". So I am wondering what is my mistake here?

採用された回答

madhan ravi
madhan ravi 2020 年 9 月 22 日
編集済み: madhan ravi 2020 年 9 月 22 日
a(randi(numel(a), 1, numel(a))) % for unique numbers use randperm()

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by