Shuffling elements of an array!!
75 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!