Full_Name: Richard Simard
Version:
OS: Linux
Submission from: (NULL) (132.204.25.139)
In the random number generator MARSAGLIA_MULTICARRY, your algorithm is
different than the one in the original reference that you give in the R manual:
Marsaglia in his post to the mailing list {\it sci.stat.math} on September 29,
1997.
The last line in the R program has a ^
while Marsaglia's algorithm has a +.
This gives very different random number generators.
The full line in RNG.c is:
return ((I1 << 16)^(I2 & 0177777)) * i2_32m1; /* in [0,1) */
RNG.c: unif_rand, MARSAGLIA_MULTICARRY (PR#2437)
3 messages · simardr@IRO.UMontreal.CA, Peter Dalgaard, Richard Simard
simardr@IRO.UMontreal.CA writes:
Full_Name: Richard Simard
Version:
OS: Linux
Submission from: (NULL) (132.204.25.139)
In the random number generator MARSAGLIA_MULTICARRY, your algorithm is
different than the one in the original reference that you give in the R manual:
Marsaglia in his post to the mailing list {\it sci.stat.math} on September 29,
1997.
The last line in the R program has a ^
while Marsaglia's algorithm has a +.
This gives very different random number generators.
The full line in RNG.c is:
return ((I1 << 16)^(I2 & 0177777)) * i2_32m1; /* in [0,1) */
Did you actually try that? As far as I can see the first operand will be (32-bit binary) xxxxxxxxxxxxxxxx0000000000000000 and the other one is 0000000000000000xxxxxxxxxxxxxxxx so it is the same whether you add them or use bitwise OR or bitwise XOR.
O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907
On 9 Jan 2003, Peter Dalgaard BSA wrote:
simardr@IRO.UMontreal.CA writes:
Full_Name: Richard Simard
Version:
OS: Linux
Submission from: (NULL) (132.204.25.139)
In the random number generator MARSAGLIA_MULTICARRY, your algorithm is
different than the one in the original reference that you give in the R manual:
Marsaglia in his post to the mailing list {\it sci.stat.math} on September 29,
1997.
The last line in the R program has a ^
while Marsaglia's algorithm has a +.
This gives very different random number generators.
The full line in RNG.c is:
return ((I1 << 16)^(I2 & 0177777)) * i2_32m1; /* in [0,1) */
Did you actually try that? As far as I can see the first operand will be (32-bit binary) xxxxxxxxxxxxxxxx0000000000000000 and the other one is 0000000000000000xxxxxxxxxxxxxxxx so it is the same whether you add them or use bitwise OR or bitwise XOR.
Very sorry, you are right. Still it is a very bad generator. It would be better to use the Mersenne-Twister or the Knuth-TAOCP-2002 as the default generator in R. ================================================= Richard Simard <simardr@IRO.UMontreal.CA> Laboratoire de simulation et d'optimisation Université de Montréal, Dépt. IRO local: 3342; tél: 514-343-6111 #3549