There are numerous Monte Carlo transport codes written in Fortran that are sorely in need of an upgrade with respect to random number generation. This becomes a critical issue as the limits of parallel computing are extended for Monte Carlo applications. To satisfy this need, we have supplied a Fortran interface to the RNG library.
The key obstacle to providing a Fortran interface is the problem of supporting a 64 bit integral type to store the random number state. Typical Fortran compilers only support a 32 bit integer. We resolve this by defining the random number state to be an array of two 32 bit integers in the Fortran interface.
The subroutines that set the number of rounds and the encryption key are defined as: SUBROUTINE RNGSETKEY( INTEGER K1, INTEGER K2 )
SUBROUTINE RNGSETKEYROUNDS( INTEGER N )
The functions and subroutines that support a particular generator are defined as: SUBROUTINE RNGXSEED_I32( INTEGER ISR(2), INTEGER I, INTEGER J )
SUBROUTINE RNGXSPAWN_I32( INTEGER ISR(2), INTEGER ISA(2) )
INTEGER FUNCTION IRNGX_I32( INTEGER ISA(2) )
DOUBLE PRECISION FUNCTION DRNGX_I32( INTEGER ISA(2) )
REAL FUNCTION FRNGX_I32( INTEGER ISA(2) )
The token X is one of, 64, P61, P64_10 and P62_16 as is the case for the C interface. The argument ISR is for the result, passed by reference as is customary for Fortran. The argument ISA is for the argument, passed by reference and for which the random number subroutines and functions produce a side effect.