Why does MATLAB generate identical random values after re-opening the program?
Ältere Kommentare anzeigen
I run the code below
y = rand(1,5)
and I get the following values:
0.8147 0.9058 0.1270 0.9134 0.6324
I close MATLAB and reopen it again and enter the same code and I get the same random values. Why does MATLAB create the exact same numbers each time?
1 Kommentar
"Why does MATLAB create the exact same numbers each time?"
Because:
- computers can't really generate random numbers.
- that is exactly what MATLAB is specified to do:
Akzeptierte Antwort
Weitere Antworten (1)
madhan ravi
am 24 Jul. 2018
Bearbeitet: madhan ravi
am 24 Jul. 2018
hi, see the link below:
https://www.mathworks.com/help/matlab/ref/rng.html
1 Kommentar
madhan ravi
am 24 Jul. 2018
did you try
rng('shuffle')
Kategorien
Mehr zu Random Number Generation finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!