Yaroslav Halchenko <li...@onerussian.com> wrote:

> it is in src/main/RNG.c (ack is nice ;) )... from visual inspection looks 
> "matching"

I see... It's a rather vanilla Mersenne Twister, and it just use 32 bits of
randomness. An signed int32 is multiplied by 2.3283064365386963e-10 to
scale it to [0,1). Then they also have a function called "fixup" that
prevents 0 or 1 from being returned. If the generated random value x <= 0.0
they return 0.5*2.328306437080797e-10, and if (1.0-x)<=0.0 they return
1.0-0.5*2.328306437080797e-10. 

http://svn.r-project.org/R/branches/R-3-1-branch/src/main/RNG.c

Also note that the algorithm used to set the seed is important. If you set
a seed equal 1 in NumPy, that might not mean the same in R. And then of
course there is the algorithm used to sample integers. 

Sturla

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to