Shuffling elements of an array!!
99 views (last 30 days)
Show older comments
Abhishek Vashishtha on 23 Jun 2020
Commented: madhan ravi on 23 Jun 2020
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 on 23 Jun 2020
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!!
More Answers (0)
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!