number have short periods (only a few "random" numbers are generated before the first "random" number is repeated and the sequence restarts). If addition is used, it is required that at least one of the first k values chosen to initialise the generator be odd. If multiplication is used, instead, it is required that all the first k values be odd, and further that at least one of them is ±3 mod 8. It has been suggested that good ratios between and are approximately the golden ratio. Problems with LFGs In a paper on four-tap shift registers, Robert M. Ziff, referring to LFGs that use the XOR operator, states that "It is now widely known that such generators, in particular with the two-tap rules such as R(103, 250), have serious deficiencies. Marsaglia observed very poor behavior with R(24, 55) and smaller generators, and advised against using generators of this type altogether. ... The basic problem of two-tap generators R(a, b) is that they have a built-in three-point correlation between , , and , simply given by the generator itself ... While these correlations are spread over the size of the generator itself, they can evidently still lead to significant errors.". This only refers to the standard LFG where each new number in the sequence depends on two previous numbers. A three-tap LFG has been shown to eliminate some statistical problems such as failing the Birthday Spacings and Generalized Triple tests. The initialization of LFGs is a very complex problem. The output of LFGs is very sensitive to initial conditions, and statistical defects may appear initially but also periodically in the output sequence unless extreme care is taken. Another potential problem with LFGs is that the mathematical theory behind them is incomplete, making it necessary to rely on statistical tests rather than theoretical performance. Usage Freeciv uses a lagged Fibonacci generator with {j = 24, k = 55} for its random number generator. The Boost library includes an implementation of a lagged Fibonacci generator. Subtract with carry, a lagged Fibonacci generator engine, is included in the C++11 library. The Oracle Database implements this generator in its DBMS_RANDOM package (available in Oracle 8 and newer versions). See also Wikipedia page 'List of random number generators' lists other PRNGs including some with better statistical qualitites: Linear congruential generator ACORN generator Mersenne Twister Xoroshiro128+ FISH (cipher) Pike VIC cipher References Toward a universal random