[R] Random Numbers

Thomas Lumley tlumley at u.washington.edu
Tue Dec 16 20:07:25 CET 2003


On Tue, 16 Dec 2003, Silvia Perez Martin wrote:

> Hello
>
> I´m a student from Spain. I couldn´t find something about R and I was asking
> if someone could tell me which generator of random numbers use "rnorm" and
> "runif". I think I have discovered that in runif they use the inversion
> method, but I don´t find any clue where they use the Super-duper
> algorithm or the Marsaglia one, as I have read.
>

All the random number generators work by transforming a common stream of
random  32-bit integers.  The user can choose what generator to use for
this common stream.  The default  is "Mersenne-Twister".
?RNGkind will tell you how to choose other generators.

In addition, the user can choose how rnorm() transforms this stream of
32-bit numbers to the Normal distribution.  This is also covered in
?RNGkind.  The default is inversion.

Finally, users can supply either their own generator for the stream of
32-bit numbers or for the transformation to a Normal distribution.

	-thomas




More information about the R-help mailing list