Generator 49 : slatec | Random number generator tested: |
slatec |
||||||||||||||||||||||||||||||||||||||||||
Minimum value: | 0 | |||||||||||||||||||||||||||||||||||||||||||
Maximum value: | 4194303 | |||||||||||||||||||||||||||||||||||||||||||
Family: | Linear Congruential generator |
|||||||||||||||||||||||||||||||||||||||||||
Random number generator algorithms: | ||||||||||||||||||||||||||||||||||||||||||||
This is the SLATEC random number generator RAND. It is ancient. The original source code is available from NETLIB. Given the I-th number of a pseudo-random sequence, the I+1 -st number is generated from X(I+1) = (A*X(I) + C) MOD M, where here M = 2**22 = 4194304, C = 1731 and several suitable values of the multiplier A are discussed below. Both the multiplier A and random number X are represented in double precision as two 11-bit words. The constants are chosen so that the period is the maximum C possible, 4194304. In order that the same numbers be generated from machine to machine, it is necessary that 23-bit integers be reducible modulo 2**11 exactly, that 23-bit integers be added exactly, and that 11-bit integers be multiplied exactly. Furthermore, if the restart option is used (where R is between 0 and 1), then the product R*2**22 = R*4194304 must be correct to the nearest integer. The first four random numbers should be .0004127026, .6750836372, .1614754200, and .9086198807. The tenth random number is .5527787209, and the hundredth is .3600893021 . The thousandth number should be .2176990509 . In order to generate several effectively independent sequences with the same generator, it is necessary to know the random number for several widely spaced calls. The I-th random number times 2**22, where I=K*P/8 and P is the period of the sequence (P = 2**22), is still of the form L*P/8. In particular we find the I-th random number multiplied by 2**22 is given by
Several multipliers have been subjected to the spectral test. Four suitable multipliers roughly in order of goodness according to the spectral test are 3146757 = 1536*2048 + 1029 = 2**21 + 2**20 + 2**10 + 5 2098181 = 1024*2048 + 1029 = 2**21 + 2**10 + 5 3146245 = 1536*2048 + 517 = 2**21 + 2**20 + 2**9 + 5 2776669 = 1355*2048 + 1629 = 5**9 + 7**7 + 1 In the table below LOG10(NU(I)) gives roughly the number of random decimal digits in the random numbers considered I at a time. C is the primary measure of goodness. In both cases bigger is better.
|