Shuffling elements of an array!!

76 ビュー (過去 30 日間)
Abhishek Vashishtha
Abhishek Vashishtha 2020 年 6 月 23 日
コメント済み: madhan ravi 2020 年 6 月 23 日
Hi Guys,
I have assigned a vector like this:
lottery = [ 1 , 3 , 4 , 5 , 2 ];
I wanted to shuffle it in randomized array, please let me know how should I do it

採用された回答

Ashish Azad
Ashish Azad 2020 年 6 月 23 日
Hi Abhishek,
This question is answered earlier too,
meanwhile I will provide with the answer too,
try to use: lottery(randperm(length(lottery)))
randperm(n) will create a randomized vector of length n containing all the values from 1 to n in randomized manner
Please read documentation for further asist
This should work!!
  1 件のコメント
madhan ravi
madhan ravi 2020 年 6 月 23 日
Providing a complete homework solution is discouraged in this forum.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by