[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #36867] randn gives same number when rand is i
From: |
David Bateman |
Subject: |
[Octave-bug-tracker] [bug #36867] randn gives same number when rand is initialised with a random seed |
Date: |
Thu, 27 Sep 2012 02:15:10 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1 |
Update of bug #36867 (project octave):
Status: None => Wont Fix
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #1:
Firstly please note that the octave rand and randn functions are seeded
seperately and so the "seed" doesn't affect the randn. Also please note that
the use of the "seed" keyword forces the rand function to use the old and
terribly slow randlib function rather than the newer Mersenne Twister
generator. So use "state" instead of "seed" (something similar is true with
Matlab as well)
Now for the "bug": When Octave first calls rand it initializes the "state"
vector of the random generators in an attempt to have different random
sequences between instances of Octave. If the "/dev/urandom" device is
available and has sufficient entropy it is used to set the state vectors. If
there isn't sufficient entropy in /dev/urandom it falls back to using the
seconds of the date and the microseconds of the cpu time of the current
process.
Running in the manner you are, the entropy pool in /dev/urandom is exhausted
in the first call to rand (ie the call "rand*1000") and then when randn is
called to initialize the state vector of the randn generator Octave is forced
into falling back on the date and the cpu time to set the state vector of
randn. Guess what if you run your command fast enough randn gets the same
initial state.
This seems like a really artifical case, and I don't see another entropy
source we can use to set the state vectors. So I'm flagging this as "Won't
fix". Can you give a real case where this behavior causes an issue?
D.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?36867>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Octave-bug-tracker] [bug #36867] randn gives same number when rand is initialised with a random seed,
David Bateman <=