[Rd] reproducing Box-Muller numbers

Paul Gilbert pgilbert@bank-banque-canada.ca
Tue, 22 Feb 2000 13:26:34 -0500


There seems to be a minor problem with reproducing numbers from rnorm with
Box-Muller. The pattern suggests it might have something to do with the value
that gets dropped when an odd number of numbers is requested. (Details below.)

Also, could "user-supplied" be added as an option for normal.kind in RNGkind.
I'm sure the Box-Muller in R is better than my own attempt, but I would like to
be able to reproduce results I've obtained in the past.

Paul Gilbert
________

> .Random.seed <- c(200,979,1479,1542)
> rnorm(5)
[1] -1.9242522 -0.8956891  2.1221336  0.8166920 -0.1356919
> .Random.seed <- c(200,979,1479,1542)
> rnorm(5)
[1] -0.4602838 -1.9242522 -0.8956891  2.1221336  0.8166920
> .Random.seed <- c(200,979,1479,1542)
> rnorm(5)
[1] -1.9242522 -0.8956891  2.1221336  0.8166920 -0.1356919
> .Random.seed <- c(200,979,1479,1542)
> rnorm(5)
[1] -0.4602838 -1.9242522 -0.8956891  2.1221336  0.8166920


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._