bugGNU Octave - Bugs: bug #36363, Matlab uses a constant seed for...

 
 

bug #36363: Matlab uses a constant seed for its rand functions. Octave generates new seed on startup

Submitter:  Michael Godfrey <godfrey>
Submitted:  Tue 01 May 2012 04:27:12 PM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  jordigh
Originator Name:  Godfrey Open/Closed:  * Closed
Release:  * 3.6.1 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 09 May 2012 03:38:55 AM UTC, comment #3: 

I added some commentary in this changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/41d7e23f5734

Closing this report. I hope you agree.

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Tue 01 May 2012 05:04:21 PM UTC, comment #2: 

The point is not to generate the same numbers as
Matlab, which I agree is not a reasonable idea,
but to generate the same results if the same code is
run again after restarting Octave.  I think that
some users would find that convenient.

Since a change to a fixed seed start seems controversial
could I suggest adding to the phrase in the help rand:

"By default, the generator is initialized from `/dev/urandom' if it
     is available, otherwise from CPU time, wall clock time, and the
     current fraction of a second."

to include a statment that this differs from Matlab's
behavior?

As a minumum this should reduce the chances of people asking for
a change!

Michael Godfrey <godfrey>
Group Member
Tue 01 May 2012 04:46:15 PM UTC, comment #1: 

I don't think there's a point to this, and it's been discussed before. See this and associated replies.

https://mailman.cae.wisc.edu/pipermail/bug-octave/2008-March/011741.html

We don't know what's the precise algorithm and seed that Matlab is using. This is hidden and undocumented. So we can't generate the same numbers that Matlab generates.

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Tue 01 May 2012 04:27:12 PM UTC, original submission:  

The summary says it.  Matlab clrealy documents this behavior, so it
is not a bug in their view.  In this case, I tend to agree with them.  The Octave documentation also correctly documents the current behavior, but users could easily not notice right away.

So, I recommend a change for compatibility and good practise.

Michael Godfrey <godfrey>
Group Member

 

(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 jordigh (Posted a comment)
  • -email is unavailable- added by godfrey (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-05-09 jordigh StatusNone Fixed
        Assigned toNone jordigh
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code