ArticleslgStudy

biology

Lagged Fibonacci generator

Lagged Fibonacci generator is a biology topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Lagged Fibonacci generator rather than just read about it. In short: A Lagged Fibonacci generator (LFG or sometimes LFib) is an example of a pseudorandom number generator. This class of random number generator is aimed at being an improvement on the 'standard' linear congruential generator.

Key takeaways

  • Lagged Fibonacci generator belongs to biology; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Lagged Fibonacci generator to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Lagged Fibonacci generator from memory before moving on to harder problems.

Reference excerpt

A Lagged Fibonacci generator (LFG or sometimes LFib) is an example of a pseudorandom number generator. This class of random number generator is aimed at being an improvement on the 'standard' linear congruential generator. These are based on a generalisation of the Fibonacci sequence. The Fibonacci sequence may be described by the recurrence relation:

S n = S n − 1 + S n − 2 {\displaystyle S_{n}=S_{n-1}+S_{n-2}}

Hence, the new term is the sum of the last two terms in the sequence. This can be generalised to the sequence:

S n ≡ S n − j ⋆ S n − k ( mod m ) , 0 < j < k {\displaystyle S_{n}\equiv S_{n-j}\star S_{n-k}{\pmod {m}},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 = 2M), often 232 or 264. The ⋆ {\displaystyle \star } operator denotes a general binary operation. This may be either addition, subtraction, multiplication, or the bitwise exclusive-or operator (XOR). The theory of this type of generator is rather complex, and it may not be sufficient simply to choose random values for j and k. 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 algorithm is a variation on a GFSR. The GFSR is also related to the linear-feedback shift register, or LFSR.

Properties of lagged Fibonacci generators The maximum period of lagged Fibonacci generators depends on the binary operation ⋆ {\displaystyle \star } . If addition or subtraction is used, the maximum period is (2k − 1) × 2M−1 . If multiplication is used, the maximum period is (2k − 1) × 2M−3, or 1/4 of period of the additive case. If bitwise xor is used, the maximum period is 2k − 1. For the generator to achieve this maximum period, the polynomial:

y = xk + xj + 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:

(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 j and k 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 x n {\displaystyle x_{n}} , x n − a {\displaystyle x_{n-a}} , and x n − b {\displaystyle x_{n-b}} , simply given by the generator itself ... While these correlations are spread over the size p = m a x ( a , b , c , … ) {\displaystyle p=max(a,b,c,\ldots )} 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.

Example implementation A simple implementation in the C programming language may look as shown below. This implementation uses 64-bit words and has a period of (2607 -1) × 263

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 qualities:

Linear congruential generator ACORN generator Mersenne Twister Xoroshiro128+ FISH (cipher) Pike VIC cipher

References Toward a universal random number generator, G.Marsaglia, A.Zaman

Worked examples

Example 1 — a first encounter with Lagged Fibonacci generator

Start with the simplest possible case. Write down what Lagged Fibonacci generator claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In biology, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Lagged Fibonacci generator before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Lagged Fibonacci generator ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Lagged Fibonacci generator

In research
Lagged Fibonacci generator appears in biology research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Lagged Fibonacci generator in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Lagged Fibonacci generator is common in secondary-school and first-year university syllabi. It links to neighbouring topics Fibonacci numbers, Pseudorandom number generators, so understanding it makes those chapters shorter.
In everyday life
Look for Lagged Fibonacci generator outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Lagged Fibonacci generator in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Lagged Fibonacci generator means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Lagged Fibonacci generator out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Lagged Fibonacci generator in simple terms?

A Lagged Fibonacci generator (LFG or sometimes LFib) is an example of a pseudorandom number generator. This class of random number generator is aimed at being an improvement on the 'standard' linear congruential generator.

Why does Lagged Fibonacci generator matter?

Because it connects several biology ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Lagged Fibonacci generator?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Lagged Fibonacci generator.

Tags

  • Fibonacci numbers
  • Pseudorandom number generators

Keep exploring