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

[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: Mike Miller
Subject: [Octave-bug-tracker] [bug #53300] rand('state') at Octave start is not correct
Date: Wed, 7 Mar 2018 19:15:46 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0

URL:
  <http://savannah.gnu.org/bugs/?53300>

                 Summary: rand('state') at Octave start is not correct
                 Project: GNU Octave
            Submitted by: mtmiller
            Submitted on: Wed 07 Mar 2018 04:15:45 PM PST
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: GNU/Linux

    _______________________________________________________

Details:

The vector returned by rand('state') when Octave first starts up is not
correct. It is either wrong, it does not reflect the actual initialized state
of the random number generator, or maybe full initialization of the random
number generator is deferred until later.

By way of example, Octave has just started:


>> format long
>> init_state = rand ('state');
>> x = rand (4, 1)
x =

   8.509328575211026e-01
   2.406711138915200e-01
   5.562248016813642e-03
   1.887156618452461e-02

>> rand ('state', init_state);
>> y = rand (4, 1)
y =

   7.838035791867421e-01
   2.776541083181831e-01
   6.340473989655361e-01
   8.594205509389307e-01

>> rand ('state', init_state);
>> z = rand (4, 1)
z =

   7.838035791867421e-01
   2.776541083181831e-01
   6.340473989655361e-01
   8.594205509389307e-01




Once the state is set by a call to rand('state', sv), it is possible to
recreate a previous sequence of random values. But when Octave first starts,
the vector returned by rand('state') doesn't match up with the random values
that are actually returned.




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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