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]

Submitted by:  None
Submitted on:  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

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project 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.5