matlab R2020b randperm fuction is not random
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
3 commentaires
Réponse acceptée
Fangjun Jiang
le 14 Juil 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)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Startup and Shutdown dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!