octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #53299] Several rand/randn bugs with state/see


From: Dave Goel
Subject: [Octave-bug-tracker] [bug #53299] Several rand/randn bugs with state/seed behavior.
Date: Wed, 7 Mar 2018 20:55:53 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.119 Safari/537.36

Follow-up Comment #13, bug #53299 (project octave):

Rik, you wrote:

> It will be hard to switch Octave away from these random number generators.
Matlab has been trying for years to get people to abandon them. See
http://www.mathworks.com/help/matlab/math/updating-your-random-number-generator-syntax.html.





It is understandable that people want their legacy code to continue to work
(and sometimes are actually unable to change it, even if they want.). So, good
to maintain "seed".

But, they don't REALLY care what underlying mechanism rand() uses.  The output
is random, of course!

How about these (or similar) drop-in replacements. These have the advantage
that octave never silently switches behind my back to "seed", while continuing
to satisfy code that uses seed:

rand("seed", X) => actually imlements rand("state", X).

foo = rand("seed") =>  Implements K = 1e20*rand(), implement rand("state", 
K), and output K.  [or minor variants thereupon.]

rand("seed", "reset") does rand("state", "reset").

[remember that 'state' actually expects a vector, but continues to work if a
scalar is supplied. For reproducibility, we simply need to supply the same
scalar again.]

For the person that uses 'seed', his code continues to do what he expects: He
can reset the state. He can query a seed, and he can supply the same seed back
for reproducible behavior. All the while, we are actually using state.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?53299>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]