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

6 visualizzazioni (ultimi 30 giorni)
Mr M.
Mr M. il 28 Feb 2018
Commentato: Matt J il 28 Feb 2018
What is the difference, and why rand('state',sum(100*clock)) is used, and what does it mean exactly?
  2 Commenti
Shounak Shastri
Shounak Shastri il 28 Feb 2018
Modificato: Shounak Shastri il 28 Feb 2018
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 il 28 Feb 2018
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.

Accedi per commentare.

Risposte (1)

Steven Lord
Steven Lord il 28 Feb 2018
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.

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by