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

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

[Octave-bug-tracker] [bug #44046] rand('state', v) does not generate a h


From: anonymous
Subject: [Octave-bug-tracker] [bug #44046] rand('state', v) does not generate a hash when size(v)=[625, 1]
Date: Mon, 19 Jan 2015 10:15:33 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/600.2.5 (KHTML, like Gecko) Version/7.1.2 Safari/537.85.11

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

                 Summary: rand('state',v) does not generate a hash when
size(v)=[625,1]
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Mon 19 Jan 2015 10:15:32 AM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Documentation
                  Status: None
             Assigned to: None
         Originator Name: nno
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.8.2
        Operating System: Any

    _______________________________________________________

Details:

The documentation of "rand" states that:

"rand ("state", v)
You may also initialize the state vector from an arbitrary vector of length
≤ 625 for v. This new state will be a hash based on the value of v, not v
itself."

However, when v is of length 625, then Octave sets the state directly based on
the value of v, and does not compute a hash ([2] line 625).

It may also be useful to add to the documentation how Octave and Matlab can be
made to generate the same random numbers. If state is a 625x1 vector,

    % matlab code
    state(end)=uint64(625)-state(end);
    rng_state=struct();
    rng_state.State=uint32(state);
    rng_state.Type='twister';
    rng_state.Seed=uint32(0);
    rng(state)

shows the same behaviour as

    % octave code
    rand('state',state)

[1] http://octave.sourceforge.net/octave/function/rand.html
[2]
http://robotics.naist.jp/~akihiko-y/doxy/octave3.2.4/oct-rand_8cc_source.html#l00532
   




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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