Montecarlo simulations vs rng(0)

2 ビュー (過去 30 日間)
sudha
sudha 2020 年 11 月 10 日
回答済み: Ameer Hamza 2020 年 11 月 10 日
if rng(0) is used in some code which uses rand then is there any use of montecarlo simulations?
montecarlo simulations are done to average the different outputs as rand is used in code i think.
Also i have another doubt.. do we get best output when rng(0) is used?? if not used then for different runs different outputs but the best output always i observed when rng(0) is used.

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 11 月 10 日
No, rng(0) does not guarantee the best output. It is just a coincidence in your case. The purpose of rng() function is to get the same results at each run. Whether it is useful with Montecarlo depends on how you are using it. If you just place it at the beginning of your script, then it should be fine; however, if you do it inside a loop, then this is not correct.

カテゴリ

Help Center および File ExchangeMonte-Carlo についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by