next up previous contents
Next: Reading and Writing tape Up: SNOMAN Utilities Previous: Increment Seed Sequence   Contents

Generating Random Number Seeds

The titles bank SEED is used to provide seeds for the random number generator. SNOMAN now uses the lagged-Fibonacci method of Marsaglia, Zaman, and Tsang as described (but without his modifications) in F. James, A review of pseudorandom number generators, Computer Physics Communications, 60, (1990), 329. The major advantages of this algorithm for SNO are that it produces machine-independent sequences of length 2$^{144}$, which should be long enough for us. Furthermore, there are 942,377,568 different sequences of that length available by setting the first input seed to any integer in the range 1 - 31328 and the second to any integer in the range 1 - 30081. Thus every institution can run SNOMAN on the same problem without duplicating random numbers by agreeing in advance which seeds to use, and the results from more than one computer can be combined without fear of duplicating random numbers.

The major drawback of this random number generator is that the ``state" of the generator at any given time is represented by 100 real numbers and 2 integers, and if you want to restart the random number sequence from some point you need to know all of these numbers. Thus rather than save a single integer seed, as in the case of the CERNlib routine RNDM which we used to use, you should in principle save all these numbers in the data structure. This seemed a waste of memory, so we decided to waste time instead. The SEED bank therefore stores 3 integers, the first two of which are the two seeds mentioned above. The third number is the point in the sequence you wish to start from. If this is set to 0 the code just starts the sequence at the beginning. In the event of a code crash, the two random number seeds are printed out, but also how many random numbers had been already been used at the beginning of the event containing the crash (these are output to a file, the name of which can be set in the JOB bank). If this number is then used as the third entry into the SEED bank the code will run through the sequence until it reaches the same point, allowing the crash to be reproduced. This takes only a few seconds (for the 10 millionth number), and we thought it preferable to use the few seconds to clogging all our disks with 102 numbers for every event.

For further information see the Companion:-

The Random Number Generator.


next up previous contents
Next: Reading and Writing tape Up: SNOMAN Utilities Previous: Increment Seed Sequence   Contents
sno Guest Acct 2009-09-09