|
|
Line 1: |
Line 1: |
| 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]].
| | You've been exercising for a bit, lifting weights and maybe some other muscle building exercise, but how can you put on that muscle faster? And maximize your strength gains?<br><br> |
|
| |
|
| The Fibonacci sequence may be described by the [[recurrence relation]]:
| | One of the best ways to get the rest your muscles need is by sleeping. A full nights sleep will do more for you than just let your muscles recover and grow. You'll find that you're more alert, energized and happy after a solid night of sleep. The number of hours each of us need varies but you should aim for a good eight hours each night and then adjust from there.<br><br>In fact, while the many-small-meals-a-day approach is still very popular - many bodybuilders today are exploring a dieting system along opposite lines, nicknamed intermittent fasting. I'll explore this system in one of my next articles.<br><br>Carbohydrates are equally important as protein is to a muscle building program. You just can't do with out it. Not only does it help you add more mass, it is needed to help fuel your muscles through your grueling work outs for added [https://www.Gov.uk/search?q=sustained+energy sustained energy]. You won't be able to lift hard and intense with out any energy, it just won't happen.<br><br>Basically, almost all white meat (chicken and fish) and egg whites. These are the most common sources of protein that people take daily, although there are easily hundred more types of food that are high in protein. For an average skinny guy like me, chicken, fish and eggs will be good enough. If you're terribly into bodybuilding or don't like these kinds of food, protein supplements and powders might be more effective.<br><br>Getting adequate sleep is crucial in increasing muscle mass. If you fail to get enough rest, your body cannot afford to expend any energy to build muscle. Your [http://Imgur.com/hot?q=muscles muscles] will recover from workouts more quickly and build new muscle tissue if you give them not only the proper nutrients, but plenty of rest as well. Eating shortly [http://professionbound.net/wp/groups/when-building-muscle-mistakes-to-avoid/ female muscle] after weight training is thought to be critical in giving your body the fuel it needs to add muscle. You should eat and take vitamins and any supplements you may take within an hour of finishing your workout.<br><br>This is basically the plan that I myself currently use. It is composed of a twice-per-week rotation of a pressing day, leg day, and pulling day. To be clear, this means that you will be training six days in a row with one off-day.<br><br>Eat Whole Grains. Finally, you must know that if you eat whole grains you will have better chances developing your muscles and getting six pack abs. Supplement the whole grains with lots of vegetables and fruits. It is proven that dairy, lean meat are also great supplements. |
| | |
| :<math>S_n = S_{n-1} + S_{n-2}</math>
| |
| | |
| Hence, the new term is the sum of the last two terms in the sequence. This can be generalised to the sequence:
| |
| | |
| :<math>S_n \equiv S_{n-j} \star S_{n-k} \pmod{m}, 0 < j < k</math>
| |
| | |
| In which case, the new term is some combination of any two previous terms. m is usually a power of 2 (m = 2<sup>M</sup>), often 2<sup>32</sup> or 2<sup>64</sup>. The <math>\star</math> operator denotes a general [[binary operation]]. This may be either addition, subtraction, multiplication, or the [[bitwise operation|bitwise]] arithmetic 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 ==
| |
| | |
| '''Lagged Fibonacci generators''' have a maximum period of (2<sup>k</sup> - 1)*2<sup>M-1</sup> if addition or subtraction is used, and (2<sup>k</sup>-1)*k if exclusive-or operations are used to combine the previous values. If, on the other hand, multiplication is used, the maximum period is (2<sup>k</sup> - 1)*2<sup>M-3</sup>, or 1/4 of period of the additive case.
| |
| | |
| For the generator to achieve this maximum period, the polynomial:
| |
| | |
| :y = x<sup>k</sup> + x<sup>j</sup> + 1
| |
| | |
| must be [[primitive polynomial (field theory)|primitive]] over the integers mod 2. Values of j and k satisfying this constraint have been published in the literature. Popular pairs are:
| |
| | |
| :{j = 7, k = 10}, {j = 5, k = 17}, {j = 24, k = 55}, {j = 65, k = 71}, {j = 128, k = 159} [http://www.ccs.uky.edu/csep/RN/RN.html], {j = 6, k = 31}, {j = 31, k = 63}, {j = 97, k = 127}, {j = 353, k = 521}, {j = 168, k = 521}, {j = 334, k = 607}, {j = 273, k = 607}, {j = 418, k = 1279} [http://www.nersc.gov/nusers/resources/software/libs/math/random/www2.0/DOCS/www/parameters.html]
| |
| | |
| 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.<ref>http://www.cs.fsu.edu/~asriniva/papers/mlfg.ps</ref>
| |
| | |
| It has been suggested that good ratios between j and k are approximately the [[golden ratio]].<ref>"Uniform random number generators for supercomputers", Richard Brent, Proc. of Fifth Australian Supercomputer Conference, Melbourne, Dec. 1992, pp. 704-706</ref>
| |
| | |
| == 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. [[George Marsaglia|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 <math>x_{n}</math>, <math>x_{n-a}</math>, and <math>x_{n-b}</math>, simply given by the generator itself ... While these correlations are spread over the size <math>p = max(a, b, c, \ldots )</math> of the generator itself, they can evidently still lead to significant errors.".<ref>[http://arxiv.org/abs/cond-mat/9710104 "Four-tap shift-register-sequence random-number generators"], Robert M. Ziff, Computers in Physics, 12(4), Jul/Aug 1998, pp. 385–392</ref> 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 [[Diehard tests|Birthday Spacings]] and Generalized Triple tests.<ref>R. P. Brent, "Uniform Random Number Generators for Supercomputers," in "Proceedings of the Fifth Australian Supercomputer Conference", pp. 95-104, 1992.</ref>
| |
| | |
| 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 {{citation needed|date=June 2008}}. 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).
| |
| * The "Pocket Dungeon" on www.BoardGameGeek.com uses it as an alternative 'Stealth' dice roll generator.
| |
| | |
| ==See also==
| |
| * [[Linear congruential generator]]
| |
| * [[Mersenne twister]]
| |
| * [[FISH (cipher)]]
| |
| * [[Pike (cryptography)|Pike]]
| |
| * [[VIC cipher]]
| |
| | |
| == References ==
| |
| | |
| <references/>
| |
| | |
| {{DEFAULTSORT:Lagged Fibonacci Generator}}
| |
| [[Category:Pseudorandom number generators]]
| |
| [[Category:Fibonacci numbers]]
| |
You've been exercising for a bit, lifting weights and maybe some other muscle building exercise, but how can you put on that muscle faster? And maximize your strength gains?
One of the best ways to get the rest your muscles need is by sleeping. A full nights sleep will do more for you than just let your muscles recover and grow. You'll find that you're more alert, energized and happy after a solid night of sleep. The number of hours each of us need varies but you should aim for a good eight hours each night and then adjust from there.
In fact, while the many-small-meals-a-day approach is still very popular - many bodybuilders today are exploring a dieting system along opposite lines, nicknamed intermittent fasting. I'll explore this system in one of my next articles.
Carbohydrates are equally important as protein is to a muscle building program. You just can't do with out it. Not only does it help you add more mass, it is needed to help fuel your muscles through your grueling work outs for added sustained energy. You won't be able to lift hard and intense with out any energy, it just won't happen.
Basically, almost all white meat (chicken and fish) and egg whites. These are the most common sources of protein that people take daily, although there are easily hundred more types of food that are high in protein. For an average skinny guy like me, chicken, fish and eggs will be good enough. If you're terribly into bodybuilding or don't like these kinds of food, protein supplements and powders might be more effective.
Getting adequate sleep is crucial in increasing muscle mass. If you fail to get enough rest, your body cannot afford to expend any energy to build muscle. Your muscles will recover from workouts more quickly and build new muscle tissue if you give them not only the proper nutrients, but plenty of rest as well. Eating shortly female muscle after weight training is thought to be critical in giving your body the fuel it needs to add muscle. You should eat and take vitamins and any supplements you may take within an hour of finishing your workout.
This is basically the plan that I myself currently use. It is composed of a twice-per-week rotation of a pressing day, leg day, and pulling day. To be clear, this means that you will be training six days in a row with one off-day.
Eat Whole Grains. Finally, you must know that if you eat whole grains you will have better chances developing your muscles and getting six pack abs. Supplement the whole grains with lots of vegetables and fruits. It is proven that dairy, lean meat are also great supplements.