Monday, February 16, 2015

Fortran90's intrinsic RNG versus Numerical Recipes' RNG

I tried to do a simple speed test between Fortran90's intrinsic random number generator (random_number) and Numerical Recipes' rand(seed). I have been using the latter for a long time, and was hoping that a switch to a native RNG might be more efficient.

I tried to generate 100 million uniformly distributed random numbers using both as outlined in this program. Here is the output:

 Intrinsic RNG Elapsed time    3.11599994    
 NR RNG Elapsed time    1.58000016 

In this test (Desktop running Linux/Ubuntu), the NR RNG seemed to be almost two times faster than Fortran's intrinsic RNG.

No comments: