[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #53300] rand('state') at Octave start is not c
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #53300] rand('state') at Octave start is not correct |
Date: |
Thu, 8 Mar 2018 19:05:08 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0 |
Update of bug #53300 (project octave):
Status: None => In Progress
_______________________________________________________
Follow-up Comment #3:
This also works
tmp = randn ("state");
init_state = rand ("state");
x1 = rand (4,1);
rand ("state", init_state);
x2 = rand (4,1);
isequal (x1,x2)
I can sort of trace what is happening, but don't have a solution yet. The
situation seems to be connected with a variable rand_state which holds the
internal state for each of the random number generators. By using any
function which switches the distribution away from the default rand, and then
switching back, the behavior works.
I also get things to work by changing the default value of the
current_distribution in the constructor.
octave_rand::octave_rand (void)
: current_distribution (normal_dist), use_old_generators (false),
rand_states ()
By making the default randn, rand will work. But this just kicks the problem
down the road because now the randn state does not work correctly at startup.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?53300>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #53300] rand('state') at Octave start is not correct, Mike Miller, 2018/03/07
- [Octave-bug-tracker] [bug #53300] rand('state') at Octave start is not correct, Mike Miller, 2018/03/07
- [Octave-bug-tracker] [bug #53300] rand('state') at Octave start is not correct, Michael Godfrey, 2018/03/08
- [Octave-bug-tracker] [bug #53300] rand('state') at Octave start is not correct,
Rik <=
- [Octave-bug-tracker] [bug #53300] rand('state') at Octave start is not correct, Rik, 2018/03/08
- [Octave-bug-tracker] [bug #53300] rand('state') at Octave start is not correct, Avinoam Kalma, 2018/03/09
- [Octave-bug-tracker] [bug #53300] rand('state') at Octave start is not correct, Rik, 2018/03/09
- [Octave-bug-tracker] [bug #53300] rand('state') at Octave start is not correct, Avinoam Kalma, 2018/03/09
- [Octave-bug-tracker] [bug #53300] rand('state') at Octave start is not correct, Mike Miller, 2018/03/09