RNG

Paul Gilbert pgilbert@bank-banque-canada.ca
Thu, 5 Nov 1998 10:19:42 -0500


Brian Ripley writes:

>But beware: it is not just the
>PRNG but all the variate generators that needs to be unchanged, and large
>simulations may well depend on rounding errors

I can certainly attest to this. One undocumented change between Splus 3.1 and
3.2 (or 3.2 and 3.3 maybe) was a change in the link libraries, resulting in a
very small change in the values of normally distributed random numbers. It took
me a very long time to discovery why I couldn't reproduce some results. (They
also dropped zeros from the uniform but that was more obvious.)

>and so not be reproducible
>except on the same version of R compiled on the same compiler.

Despite my above comment I've had very good luck in this regard. Since the
change in the RNG about R 0.49 I've been able to reproduce results to within
reasonable tolerances on Sun4, Sun5 and Linux (although I haven't tried linux
recently.)

>I think a decent API for random-number generators is quite hard to
>do: what is the structure for the seeds, for example?

Martin Maechler and I discussed this some time ago and as I recall there are a
few non-trivial issues. I think the seed would have to be specific to the
generator, or perhaps it would be possible to have a "universal seed" which can
be used to generate the seed for a specific generator. Then any new generator
would need to come with a method for generating its seed from the universal one.

One of my interests in this is to be able to produce the same random numbers in
S, Splus, and R, so that I don't need to have different versions of my test
programs. For this I don't need to use the Splus generator but I need to put a
"wrapper" around the generator so that I can do the same thing in Splus.

Paul Gilbert



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._