bugGNU Octave - Bugs: bug #44046, doc: rand('state',v) does not...

 
 

bug #44046: doc: rand('state',v) does not generate a hash when size(v)=[625,1]

Submitter:  None
Submitted:  Mon 19 Jan 2015 10:15:32 AM UTC
   
 
Category:  Documentation Severity:  2 - Minor
Priority:  3 - Low Item Group:  Documentation
Status:  None Assigned to:  None
Originator Name:  nno Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * dev
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 19 Jan 2015 10:15:32 AM UTC, original submission:  

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

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-05-01 mtmiller CategoryOctave Function Documentation
        Severity3 - Normal 2 - Minor
        Priority5 - Normal 3 - Low
        Release3.8.2 dev
        Summaryrand('state',v) does not generate a hash when size(v)=[625,1] doc: rand('state',v) does not generate a hash when size(v)=[625,1]

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code