Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: random generator seed
Replies: 4   Last Post: Jan 25, 2013 5:41 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 17,944
Registered: 12/7/04
Re: random generator seed
Posted: Jan 25, 2013 5:27 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply



"Elnaz " <ebsadeghian@gmail.com> wrote in message
news:kdur27$4sr$1@newscl01ah.mathworks.com...
> Hi all,
> I am running several MATLAB in parallel and I want to have my script
> running on several machines generate the same random numbers. To do this,
> I am doing rng('default'); Is this the same as doing:
> rand('state',0); % set state to 0


No, and you probably shouldn't be doing the latter if you can avoid it.

> In other worsd, is the default setting '0'?

No. See the page linked in the Note at the top of the Description section
for a more thorough explanation of what rng('default') is doing and why we
discourage the rand(string, seedValue) and randn(string, seedValue)
syntaxes.

http://www.mathworks.com/help/matlab/ref/rng.html

That page also lists the RNG equivalent for "rand('state', 0)" if you need
to reproduce results from older releases of MATLAB.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.