Why does MATLAB generate identical random values after re-opening the program?
古いコメントを表示
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 件のコメント
"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:
採用された回答
その他の回答 (1 件)
madhan ravi
2018 年 7 月 24 日
編集済み: madhan ravi
2018 年 7 月 24 日
hi, see the link below:
https://www.mathworks.com/help/matlab/ref/rng.html
1 件のコメント
madhan ravi
2018 年 7 月 24 日
did you try
rng('shuffle')
カテゴリ
ヘルプ センター および File Exchange で Random Number Generation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!