Difference between Matlab and Octave in random seeding
Jaroslav Hajek
highegg at gmail.com
Mon Mar 3 02:51:14 CST 2008
On Mon, Mar 3, 2008 at 9:32 AM, John W. Eaton <jwe at bevo.che.wisc.edu> wrote:
> On 3-Mar-2008, Jaroslav Hajek wrote:
>
>
> | On Mon, Mar 3, 2008 at 8:55 AM, John W. Eaton <jwe at bevo.che.wisc.edu> wrote:
> | > On 1-Mar-2008, dbateman wrote:
> | >
> | > | I asked at the time that the Mersenne twister code was included in Octave
> | > | whether we wanted independent generator states per generator or not, and if
> | > | I remember correctly it didn't seem important. Note also that there are a
> | > | number of additional random generator functions that are derived from the
> | > | base generator in the statistics package, and so the state of these
> | > | generators will depend on the underlying generator functions. I don't have
> | > | access to matlab and so can't check, but how do things like exprnd depend on
> | > | the state of the rand and randn generators in Matlab? I suspect that they
> | > | rely on the same underlying generators. However as Octave has a ziggurat
> | > | implementation of rande that is also used for exprnd, then this change will
> | > | mean that Octave is now different than Matlab in a different manner. Should
> | > | we care as this will only affect the users of the matlab statistics
> | > | toolbox..
> | >
> | > OK, I don't know what is best here. Would someone (not David) please
> | > check the Matlab behavior of exprnd, rand, and randn when setting the
> | > state? If you set the state for rand or randn, is the exprnd sequence
> | > also reinitialized, or is it independent?
> | >
> |
> | In matlab, rand and randn seem to have independent internals, but the
> | rest like exprnd, gamrnd are implemented using calls to rand and/or
> | randn.
>
> OK, again, I'm not sure what is best. We could make the states
> different for rand and randn, and have the others share the state with
> either rand or randn, but that doesn't solve the problem if rand and
> randn are both used to generate some other rand sequence (I don't know
> whether that ever happens). In any case, isn't it better that the
> states can be set independently?
>
I guess that depends. Personally, I'd prefer to have a single seed for
all random numbers, because that's what I would expect, and that's
also how I would write a new one - calling the existing ones. The
independence of rand and randn in Matlab just surprised me.
> jwe
>
--
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
More information about the Bug-octave
mailing list