matlab R2020b randperm fuction is not random
1 次查看(过去 30 天)
显示 更早的评论
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
采纳的回答
Fangjun Jiang
2022-7-14
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)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!