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

 
 

bug #44046: 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: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Documentation
Status: NoneAssigned to: None
Originator Name: nnoOriginator Email: -unavailable-
Open/Closed: OpenRelease: 3.8.2
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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by None (Submitted the item)
  •  

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup1