works ran2 in a 64 bit machine?


lorubenet
07-10-2007, 04:47 AM
Hi!

I am using ran2 in my MonteCarlo simulation using the NR in C (though my program is in C++). I'd like to know whether the algorithm is just implemented to work on a 32bit machine or if it performs as good in a 64-bit machine (if not, which random number generator should I use?). I'm worried about the issues of "long" being 4 or 8 bytes.
Thanks,
Ruben

lorubenet
08-08-2007, 02:20 AM
Ok... I wrote a small program and checked... it works 32 and 64 bits machines give the same answer.

A problem can appear if one does the 'dirty trick' somewhere in the code
#define float double (or long double)
that gives sort of crazy results...

Bill Press
10-11-2007, 11:58 AM
By the way, the new random number generator routines in Numerical Recipes Third Edition are all natively 64-bit, though they will compile correctly on 32-bit compilers as well. :)