matlab R2020b randperm fuction is not random
1 view (last 30 days)
Show older comments
Hi,
When I use matlab R2020b on linux platform, commands follow:
order = randperm(10)
disp(order)
results show:
6 3 7 8 5 1 2 4 9 10
6 3 7 8 5 1 2 4 9 10
Curiously, the result is fixed,i.e., when I run this script again, the same results appear. Does anybody know what's wrong? thanks
Accepted Answer
Fangjun Jiang
on 14 Jul 2022
Duh! You store the result in "order" and display it again. Of course they are the same!
order = randperm(10)
disp(order)
order = randperm(10)
disp(order)
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!