Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Uniform random number generator (RNG)

  1. Aug 3, 2008 #1
    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 ???
  2. jcsd
  3. Aug 3, 2008 #2


    User Avatar
    Science Advisor
    Homework Helper

  4. Aug 13, 2011 #3
    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.
  5. Aug 13, 2011 #4

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook