Skip to content
Prev 5853 / 398506 Next

Needed: Understading runif() output :-)

At 06:38 25-05-00, Kjetil Kjernsmo wrote:
Mersenne Twister pseudo-random numbers are based on 32-bit
unsigned integers.  R uses 64-bit doubles, and if you want all
bits random, you need to combine two uniforms.  Something like

x <- (1.0 - 2^-32) * first.uniform + 2 ^ -32 * second.uniform

should work.  For efficiency, use the actual values of the two
constants, and make first.uniform and second.uniform vectors of
1000 or more uniforms.

--Ivan Frohne

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._