Ranf is a 48 bit multiplicative congruential method RNG which produces 64 bit floating point numbers in the open interval (0,1). More precisely, it produces a sequence of uniform variates based on the following formulas:
where the (integer) multiplier = 0x2875a2e7b175 43.1and the (integer) default seed = 0x948253fc9cd1. Note that the minimum value for is and the maximum value is . 43.2
On the Cray, ranf is loaded from the Mathlib library. The workstation version is based on the drand48 suite of library functions. Although these two libraries implement the same basic arithmetic, there is a subtle difference in that drand48 computes the next seed and returns that value divided by , whereas ranf saves the old seed, computes the next, and then returns the old seed divided by . The result is that the sequence from drand48 is "one ahead" of that from ranf. This problem may be solved by decrementing or incrementing the seed by one as part of setting or retrieving it, respectively, and this logic is built into the workstation versions of setranf and getranf routines below. Thus sequences generated by theBasis ranf are identical on Cray or workstation, and seed values may be carried between the two architectures without a break in the sequence.
The examples below are written as they would appear in source to be preprocessed by Mppl. In Fortran terms, ranf will return double precision on a 32 bit workstation, and real on a 64 bit architecture.