Generator 7 : gfsr4 | Random number generator tested: |
gfsr4 |
Minimum value: | 0 | Maximum value: | 4294967295 |
Random number generator algorithms: | |
A generalized feedback shift-register (GFSR) is basically an xor-sum of particular past lagged values as follows: rn = rn-A ^ rn-B ^ rn-C ^ rn-D Ziff (ref below) notes that "it is now widely known" that two-tap registers (such as R250, which is described below) have serious flaws, the most obvious one being the three-point correlation that comes from the definition of the generator. Nice mathematical properties can be derived for GFSR's, and numeric bears out the claim that 4-tap GFSR's with appropriately chosen offsets are as random as can be measured, using the author's test.This implementation uses the values suggested the example on p392 of Ziff's article: A=471, B=1586, C=6988, D=9689. If the offsets are appropriately chosen (such the one ones in this implementation), then the sequence is said to be maximal. I'm not sure what that means, but I would guess that means all states are part of the same cycle, which would mean that the period for this generator is astronomical; it is (2K)D approx 1093334 where K=32 is the number of bits in the word, and D is the longest lag. This would also mean that any one random number could easily be zero; i.e. 0 <= r < 232. This implementation uses the values suggested the author's example on p392, but altered to fit the GSL framework. The "state" is 214 longs, or 64Kbytes; 214 is the smallest power of two that is larger than D, the largest offset. Ziff doesn't say so, but it seems to me that the bits are completely independent here, so one could use this as an efficient bit generator; each number supplying 32 random bits. The quality of the generated bits depends on the underlying seeding procedure, which may need to be improved in some circumstances. For more information see, Robert M. Ziff, "Four-tap shift-register-sequence random-number generators", Computers in Physics, 12(4), Jul/Aug 1998, pp 385-392. |