Hi,
I am using Matlab version 6.1.
I am using the Rand function to generate random numbers but would like to clarify a number of things.
Is RAND based on the CPU Clock cycle?
Also, if I use
rand('seed',fix(100*(sum(clock))));
does this ensure my seed is changed every time?
Thanks
Comments
Besides, this is taken from the on-line help for version 7.0.1
(sorry, I don't have your version)
Return RAND to its default initial state.
rand('state',0)
Initialize RAND to a different state each time.
rand('state',sum(100*clock))
Save the current state, generate 100 values, reset the state,
and repeat the sequence.
s = rand('state');
u1 = rand(100);
rand('state',s);
u2 = rand(100); % contains exactly the same values as u1
.
.
Learn Matlab by-example!
http://www.matrixlab-examples.com