"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
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
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!