Difference between Matlab and Octave in random seeding
David Bateman
David.Bateman at motorola.com
Mon Mar 3 04:18:49 CST 2008
Jaroslav Hajek wrote:
> 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.
>
>
I don't think there is anyway to address this if we keep rande, randg
and randp functions in Octave. I'd hate to loose these as they are so
much faster than depending on a derivation from rand/randn. I'd say
leave it as is...
D.
--
David Bateman David.Bateman at motorola.com
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
More information about the Bug-octave
mailing list