Download Swarm User Guide
Transcript
Appendix C. Random Library Appendix ii. The lagged-Fibonacci generators (ACG, SWBi, PSWB) all fail the Diehard ‘Birthday Spacings Test’, and are therefore only conditionally recommended for use. iii. The other 32-bit generators pass all tests, and I therefore have no reason not to recommend them all for use. iv. The 31-bit generators all fail certain tests because one bit has a constant value. Beyond that they all seem to be ok. b. We want a generator to have a long enough period for our purpose, and in general the longer the period the better. (However, note that to generate 2 64 random numbers from a fast generator like MT19937 would take 2.1 million years on a 486/66, so in practice any generator with a period close to 260 or larger will be acceptable.) The PMMLCG generators, although they are of acceptable quality otherwise, have a period less than 2 31 which we can exhaust in under 3 hours. So use those only for quick ‘toy’ applications. c. We want a generator to execute efficiently, the faster the better. The Generators data table indicates the execution times for the generators as implemented. d. We want a generator to take as little resources (memory) as possible. The Generators data table indicates the size of each generator’s state in bits. e. Other things being equal, we want our generator to have a single full period rather than a number of shorter periods, since we may not know whether a particular starting seed will put us into a long or a short subcycle. This disqualifies SWB, and possibly the new MWC and RWC generators (Marsaglia does not say how many periods these generators have, but only gives the period length.) C.3.1.2. Strategy For Using Random Generators There are 3 possible strategies for using random generators: a. Use one single generator for your whole simulation, and have all ‘users’ of randomness (distributions and other objects) call this single generator in an interleaved fashion. For this purpose, generators such as MT19937, TT800, TT775, TT443 (and possibly PSWB and SWB) seem particularly well suited since they have immense periods. The code in random/random.m shows how to connect several distribution objects to a single random generator. The generator randomGenerator supplied there is of class MT19937. b. Use a single generator of long period, but divide this long period up into a number of non-overlapping (hence statistically independent) segments, and let each ‘user’ of randomness draw their random numbers from separate segments. Doing this requires that we be able to quickly access these separate segments. The ‘split’ generators C2LCGX and C4LCGX implement such a scheme. 157