Random Number Generator: Difference between revisions
Jump to navigation
Jump to search
[unchecked revision] | [unchecked revision] |
Content deleted Content added
m fixed unencyclopedic tone |
m an -> a |
||
Line 92: | Line 92: | ||
=== Fibonacci random number === |
=== Fibonacci random number === |
||
A special "remake" of the Fibonacci sequence can be used to generate random numbers. This is done by having 4 "seeds", which start off as really weird values (e.g. 45, 80, 22, 32). |
A special "remake" of the Fibonacci sequence can be used to generate random numbers. This is done by having 4 "seeds", which start off as really weird values (e.g. 45, 80, 22, 32). |
||
The seed() function adds a new seed to the end of the sequence, and erases the first one (the seeds are referred to as A, B, C and D). The rand() function just returns the sum of the seeds, and calls seed() with the result. [[User:Mariuszp|Glidix]] is |
The seed() function adds a new seed to the end of the sequence, and erases the first one (the seeds are referred to as A, B, C and D). The rand() function just returns the sum of the seeds, and calls seed() with the result. [[User:Mariuszp|Glidix]] is a good example of this RNG implementation. |
||
=== Linear feedback shift register === |
=== Linear feedback shift register === |