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

Submitted by:  Michael Godfrey <godfrey>
Submitted on:  Tue 01 May 2012 04:27:12 PM UTC  
 
Category: LibrariesSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: Jordi Gutiérrez Hermoso <jordigh>
Originator Name: GodfreyOpen/Closed: Closed
Release: 3.6.1Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

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>
Project AdministratorIn charge of this item.
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>
Project 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>
Project AdministratorIn charge of this item.
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>
Project Member

 

(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 jordigh (Posted a comment)
  • -unavailable- added by godfrey (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):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 09 May 2012 03:38:55 AM UTCjordighStatusNone=>Fixed
      Assigned toNone=>jordigh
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1