seed for Monte Carlo
9 ビュー (過去 30 日間)
古いコメントを表示
I am running a Monte carlo simulation and I have set the seed outside the monte carlo simulation. However, one of my basic assumptions is that two variables are independent. I am wondering whether the two variables generated by using the same seed will be dependent so that I will have to change the seed for each iteration of the monte carlo simulation. If the latter holds, how do i do that? I have calculated the correlation between the two and it is close to 0.(However zero correlation does not imply independence)
0 件のコメント
回答 (1 件)
Jeff Miller
2019 年 12 月 4 日
It sounds like you would be better off not to set the seed at all--just use MATLAB's default seed, which is different every time it starts.
Usually the only reason for setting the seed is to make sure that you can recreate the same set of random values in a later run, and it doesn't sound like you want to do that.
2 件のコメント
Guillaume
2019 年 12 月 4 日
"just use MATLAB's default seed, which is different every time it starts."
Hum, no actually. Matlab default seed is always the same: 0. If you restart matlab, you're guaranteed to get the exact same sequence of numbers every time.
The easiest way to make sure you get a different random sequence every time you restart matlab is with:
rng('shuffle')
On the other hand, if you don't restart matlab between runs of the monte-carlo simulation, it doesn't really matter what the starting seed was, the numbers will be random from run to run, as long as you don't reset the seed between each run.
参考
カテゴリ
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!