[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
restoring state of rand()
From: |
Michael Creel |
Subject: |
restoring state of rand() |
Date: |
Fri, 15 Oct 2004 10:22:19 +0200 |
User-agent: |
KMail/1.7 |
Hello,
"help rand" tells me that
<quote>
You can query the state of the random number generator using the
form
v = rand ("state")
This returns a column vector V of length 625. Later, you can
restore the random number generator to the state V using the form
rand ("state", v)
</quote>
but my mileage varies:
octave:1> help rand
octave:2> v = rand("state");
octave:3> rand(3,1)
ans =
0.82058
0.29780
0.98109
octave:4> rand("state",v);
octave:5> rand(3,1)
ans =
4.4409e-17
4.4409e-17
4.4409e-17
Can anyone help me out? I'm using octave-forge compiled against octave 2.1.57
Michael
-------------------------------------------------------------
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
-------------------------------------------------------------
- restoring state of rand(),
Michael Creel <=