Date: Jan 25, 2013 5:27 PM
Author: Steven Lord
Subject: Re: random generator seed

"Elnaz " <> wrote in message
> 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)

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

Steve Lord
To contact Technical Support use the Contact Us link on