What is the difference between rnd(s) and rand('state',s)?

15 ビュー (過去 30 日間)
Mr M.
Mr M. 2018 年 2 月 28 日
コメント済み: Matt J 2018 年 2 月 28 日
What is the difference, and why rand('state',sum(100*clock)) is used, and what does it mean exactly?
  2 件のコメント
Shounak Shastri
Shounak Shastri 2018 年 2 月 28 日
編集済み: Shounak Shastri 2018 年 2 月 28 日
Sorry but I cannot find anything which is named "rnd". Do you mean "rng" ? Also, please tell us the version of matlab you are using.
Matt J
Matt J 2018 年 2 月 28 日
Also, please close your many open threads by Accept-clicking the helpful answers. It looks like you got no shortage of them and doing so should ensure responsiveness to your questions.

サインインしてコメントする。

回答 (1 件)

Steven Lord
Steven Lord 2018 年 2 月 28 日
See the first section on this documentation page for some of the reasons why rand('state', x) is strongly discouraged. If you're using a release prior to the introduction of rng you may need that syntax, but for new code or if you're updating old code you should use rng instead.

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by