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: rng(0) error in Neural Network
Replies: 1   Last Post: Mar 6, 2013 5:02 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Peter Perkins

Posts: 111
Registered: 8/12/11
Re: rng(0) error in Neural Network
Posted: Mar 6, 2013 5:02 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Lin, the error message in its entirety say this:

"The current random number generator is the legacy generator. This is
because you have executed a command such as rand('state',0), which
activates MATLAB's legacy random number behavior. You may not use RNG
to reseed the legacy random number generator.

Use rng('default') to reinitialize the random number generator to its
startup configuration, or call RNG using a specific generator type, such
as rng(seed,'twister')."

So here's what happened: some time between when you started up MATLAB
and when you tried to use the rng function, either you, some of your
code, or some code you ran executed a command such as

rand('state',0)

or

randn('seed',0)

which has the effect of resetting MATLAB's random number generators to
their old pre-R2008 configuration and behaviors. The rng function
refuses to reseed the "legacy" generators.

That command is _strongly_ not recommended, and has been for a number of
years. If you typed something like that at the command line, or put a
line like that in a function or a script that you wrote, you should
replace it as described here

http://www.mathworks.com/help/matlab/math/updating-your-random-number-generator-syntax.html

which you can also find if you look at the reference page for the rng
function

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

If you can't figure out where that command is being executed, it may be
that you've downloaded code for MATLAB Central that is doing it.

Hope this helps.


On 3/5/2013 4:24 PM, Lin wrote:
> Hi!
> I am using Matlab2011b version. In order for the Ntrials, to find the R2
> values for train/val/test, i used rng(0) before my fitnet(H). I have the
> following error:
> ???Error Using>>rng at 97
> The current random number generator is the legacy generator. This is
> because you have executed a command such as
> rand('state',0), which activates MATLAB.....................
>
> Anybody's help!





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.