help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rand('twister')


From: David Bateman
Subject: Re: rand('twister')
Date: Fri, 11 Dec 2009 20:01:45 +0100
User-agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090706)


The "state" and "twister" option in Octave both call mersenne twister algorithm and have since they were introduced. Matlab's random generator wasn't well documented and so Octave never implemented.. I suppose this means we should remove the "twister" option, but who cares..

Note that the generator used in octave with "seed" are the randlib generators from netlib that are rather slow, and don't generate the same sequences as the matlab generator used with "seed". The MT generator in Octave also does generate the same sequences as the matlab versions due to issues masking bits from the 32bit values generated by the MT generators to the 52 bits of the mantissa of an IEEE754 double. Octave clearly doesn't do it the same way. Maybe now that the default Matlab generator is the MT, perhaps it makes sense to try and generate the same sequences..

D....



Joseph Wakeling wrote:
Hello all,

A query about the random number generator in Octave.

In MATLAB there was until recently a problem with the default random
number generator:
http://www2.cs.cas.cz/~savicky/papers/rand2006.pdf

... which could be worked around by calling the random number generator
with,

  rand('twister',seed)

The more recent MATLAB versions apparently use the Mersenne Twister by
default and have removed this option (you need to replace the 'twister'
option with 'state').

Anyway, Octave apparently still accepts the 'twister' option ... so does
it do what I think it does, and generate numbers from the MT algorithm?

I ask because nothing at all is mentioned about it in the current
manual, even as a backwards-compatibility or deprecated feature ... :-)

Thanks & best wishes,

    -- Joe
_______________________________________________
Help-octave mailing list
address@hidden
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave



--
David Bateman                                address@hidden
35 rue Gambetta                              +33 1 46 04 02 18 (Home)
92100 Boulogne-Billancourt FRANCE            +33 6 72 01 06 33 (Mob)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]