Uniform random number generator (RNG)

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 5K views
Carter2x
Messages
3
Reaction score
0
I am writing a program in Fortran language, in which i use a Random Number Generator (RNG) subroutine.
Until now i used ran1 from " Numerical Recipes in fortran ,second edition, Page 271 ", but i think it is quite slow.
While searching on the internet for a faster RNG i found a few Fortran subroutines
(many were in other languages C/C++ ...), but they were slower than the one i had.
Do you know were can i find a fast and quite longperiod (>= 10^12) RNG ?
 
Physics news on Phys.org
Carter2x said:
I am writing a program in Fortran language, in which i use a Random Number Generator (RNG) subroutine.
Until now i used ran1 from " Numerical Recipes in fortran ,second edition, Page 271 ", but i think it is quite slow.
While searching on the internet for a faster RNG i found a few Fortran subroutines
(many were in other languages C/C++ ...), but they were slower than the one i had.
Do you know were can i find a fast and quite longperiod (>= 10^12) RNG ?

Have you tried using the one that's part of the language?

George Marsaglia developed a number of PRNGs.
Some produce integers directly, others produce floating-point values directly.
 
Carter2x said:
Until now i used ran1 from " Numerical Recipes in fortran ,second edition, Page 271 ", but i think it is quite slow.
ran1 is fast, but it is lousy (it has way too short a period). What makes you think it is slow?

You can have fast or you can have good. Asking for both at once is a bit much.