HOME

TheInfoList



OR:

A Lagged Fibonacci generator (LFG or sometimes LFib) is an example of a
pseudorandom number generator A pseudorandom number generator (PRNG), also known as a deterministic random bit generator (DRBG), is an algorithm for generating a sequence of numbers whose properties approximate the properties of sequences of random numbers. The PRNG-generate ...
. This class of random number generator is aimed at being an improvement on the 'standard'
linear congruential generator A linear congruential generator (LCG) is an algorithm that yields a sequence of pseudo-randomized numbers calculated with a discontinuous piecewise linear equation. The method represents one of the oldest and best-known pseudorandom number generat ...
. These are based on a generalisation of the
Fibonacci sequence In mathematics, the Fibonacci numbers, commonly denoted , form a sequence, the Fibonacci sequence, in which each number is the sum of the two preceding ones. The sequence commonly starts from 0 and 1, although some authors start the sequence from ...
. The Fibonacci sequence may be described by the
recurrence relation In mathematics, a recurrence relation is an equation according to which the nth term of a sequence of numbers is equal to some combination of the previous terms. Often, only k previous terms of the sequence appear in the equation, for a parameter ...
: :S_n = S_ + S_ Hence, the new term is the sum of the last two terms in the sequence. This can be generalised to the sequence: :S_n \equiv S_ \star S_ \pmod, 0 < j < k In which case, the new term is some combination of any two previous terms. ''m'' is usually a power of 2 (''m'' = 2''M''), often 232 or 264. The \star operator denotes a general
binary operation In mathematics, a binary operation or dyadic operation is a rule for combining two elements (called operands) to produce another element. More formally, a binary operation is an operation of arity two. More specifically, an internal binary op ...
. This may be either addition, subtraction, multiplication, or the bitwise exclusive-or operator (
XOR Exclusive or or exclusive disjunction is a logical operation that is true if and only if its arguments differ (one is true, the other is false). It is symbolized by the prefix operator J and by the infix operators XOR ( or ), EOR, EXOR, , , ...
). The theory of this type of generator is rather complex, and it may not be sufficient simply to choose random values for and . These generators also tend to be very sensitive to initialisation. Generators of this type employ ''k'' words of state (they 'remember' the last ''k'' values). If the operation used is addition, then the generator is described as an ''Additive Lagged Fibonacci Generator'' or ALFG, if multiplication is used, it is a ''Multiplicative Lagged Fibonacci Generator'' or MLFG, and if the XOR operation is used, it is called a ''Two-tap generalised feedback shift register'' or GFSR. The
Mersenne Twister The Mersenne Twister is a general-purpose pseudorandom number generator (PRNG) developed in 1997 by and . Its name derives from the fact that its period length is chosen to be a Mersenne prime. The Mersenne Twister was designed specifically to r ...
algorithm is a variation on a GFSR. The GFSR is also related to the
linear-feedback shift register In computing, a linear-feedback shift register (LFSR) is a shift register whose input bit is a linear function of its previous state. The most commonly used linear function of single bits is exclusive-or (XOR). Thus, an LFSR is most often a ...
, or LFSR.


Properties of lagged Fibonacci generators

The maximum period of lagged Fibonacci generators depends on the binary operation \star. If addition or subtraction is used, the maximum period is (2''k'' − 1) × 2''M''−1. If multiplication is used, the maximum period is (2''k'' − 1) × 2''M''−3, or 1/4 of period of the additive case. If bitwise xor is used, the maximum period is 2''k'' − 1. For the generator to achieve this maximum period, the polynomial: :''y'' = ''x''''k'' + ''x''''j'' + 1 must be primitive over the integers mod 2. Values of ''j'' and ''k'' satisfying this constraint have been published in the literature. Another list of possible values for ''j'' and ''k'' is on page 29 of volume 2 of ''
The Art of Computer Programming ''The Art of Computer Programming'' (''TAOCP'') is a comprehensive monograph written by the computer scientist Donald Knuth presenting programming algorithms and their analysis. Volumes 1–5 are intended to represent the central core of comp ...
'': :(24, 55), (38, 89), (37, 100), (30, 127), (83, 258), (107, 378), (273, 607), (1029, 2281), (576, 3217), (4187, 9689), (7083, 19937), (9739, 23209) Note that the smaller 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 In mathematics, two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Expressed algebraically, for quantities a and b with a > b > 0, where the Greek letter phi ( ...
."Uniform random number generators for supercomputers"
Richard Brent, 1992


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 Marsaglia is a ''comune'' (municipality) in the Province of Cuneo in the Italian region Piedmont, located about southeast of Turin and about east of Cuneo Cuneo (; pms, Coni ; oc, Coni/Couni ; french: Coni ) is a city and ''comune'' in Pie ...
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 x_, x_, and x_, simply given by the generator itself ... While these correlations are spread over the size p = max(a, b, c, \ldots ) of the generator itself, they can evidently still lead to significant errors."."Four-tap shift-register-sequence random-number generators"
Robert M. Ziff, Computers in Physics, 12(4), Jul/Aug 1998, pp. 385–392 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 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 C++11 is a version of the ISO/IEC 14882 standard for the C++ programming language. C++11 replaced the prior version of the C++ standard, called C++03, and was later replaced by C++14. The name follows the tradition of naming language versions ...
library. * The
Oracle Database Oracle Database (commonly referred to as Oracle DBMS, Oracle Autonomous Database, or simply as Oracle) is a multi-model database management system produced and marketed by Oracle Corporation. It is a database commonly used for running online ...
implements this generator in its DBMS_RANDOM package (available in Oracle 8 and newer versions).


See also

Wikipedia page '
List of random number generators Random number generators are important in many kinds of technical applications, including physics, engineering or mathematical computer studies (e.g., Monte Carlo simulations), cryptography and gambling (on game servers). This list includes many ...
' lists other PRNGs including some with better statistical qualitites: *
Linear congruential generator A linear congruential generator (LCG) is an algorithm that yields a sequence of pseudo-randomized numbers calculated with a discontinuous piecewise linear equation. The method represents one of the oldest and best-known pseudorandom number generat ...
* ACORN generator *
Mersenne Twister The Mersenne Twister is a general-purpose pseudorandom number generator (PRNG) developed in 1997 by and . Its name derives from the fact that its period length is chosen to be a Mersenne prime. The Mersenne Twister was designed specifically to r ...
* Xoroshiro128+ *
FISH (cipher) The FISH (FIbonacci SHrinking) stream cipher is a fast software based stream cipher using Lagged Fibonacci generators, plus a concept from the shrinking generator cipher. It was published by Siemens in 1993. FISH is quite fast in software and ha ...
*
Pike Pike, Pikes or The Pike may refer to: Fish * Blue pike or blue walleye, an extinct color morph of the yellow walleye ''Sander vitreus'' * Ctenoluciidae, the "pike characins", some species of which are commonly known as pikes * ''Esox'', genus ...
*
VIC cipher Vic (; es, Vic or Pancracio Celdrán (2004). Diccionario de topónimos españoles y sus gentilicios (5ª edición). Madrid: Espasa Calpe. p. 843. ISBN 978-84-670-3054-9. «Vic o Vich (viquense, vigitano, vigatán, ausense, ausetano, ausonense) ...


References


Toward a universal random number generator
G.Marsaglia, A.Zaman {{DEFAULTSORT:Lagged Fibonacci Generator Pseudorandom number generators Fibonacci numbers