
From:  Quentin Spencer 
Subject:  Re: rand('state',0) 
Date:  Thu, 13 Oct 2005 15:10:59 0500 
Useragent:  Mozilla Thunderbird 1.0.71.1.fc4 (X11/20050929) 
Steve C. Thompson wrote:
I'm collaborating with MATLAB users and they haverand('state',0) in their code. According to <http://www.mathworks.com/access/helpdesk/help/techdoc/ref/rand.html>this is used in MATLAB to ``set rand to its default initial state''. This command produces an error in Octave, however: octave:1> rand('state',0) error: rand: unrecognized string argument
What version of octave are you using? I don't get this error with 2.9.3. I haven't tried 2.1.71.
The purpose of doing something like this is usually to make simulations involving random number generation repeatable. Removing this line will probably not break the code, but it could make it nonrepeatable. Matlab and Octave don't have the same random number generator, so even with this line, you won't be able to duplicate exactly the random numbers generated in the two programs. If that's important, David Bateman posted some code to achieve that earlier this year, but it involves changing Matlab's random number generation.Can someone tell me if by simply commenting out this line of code will have any side effects?
Quentin  Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html 
[Prev in Thread]  Current Thread  [Next in Thread] 