Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Linear congruential generator
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== ''m'' a power of 2, ''c'' = 0 === Choosing ''m'' to be a [[power of two]], most often ''m'' = 2<sup>32</sup> or ''m'' = 2<sup>64</sup>, produces a particularly efficient LCG, because this allows the modulus operation to be computed by simply truncating the binary representation. In fact, the most significant bits are usually not computed at all. There are, however, disadvantages. This form has maximal period ''m''/4, achieved if ''a'' β‘ Β±3 (mod 8) and the initial state ''X''<sub>0</sub> is odd. Even in this best case, the low three bits of ''X'' alternate between two values and thus only contribute one bit to the state. ''X'' is always odd (the lowest-order bit never changes), and only one of the next two bits ever changes. If ''a'' β‘ +3, ''X'' alternates Β±1βΒ±3, while if ''a'' β‘ β3, ''X'' alternates Β±1ββ3 (all modulo 8). It can be shown that this form is equivalent to a generator with modulus ''m''/4 and ''c'' β 0.{{r|KnuthV2}} A more serious issue with the use of a power-of-two modulus is that the low bits have a shorter period than the high bits. Its simplicity of implementation comes from the fact that bits are never affected by higher-order bits, so the low ''b'' bits of such a generator form a modulo-2<sup>''b''</sup> LCG by themselves, repeating with a period of 2<sup>''b''β2</sup>. Only the most significant bit of ''X'' achieves the full period.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Linear congruential generator
(section)
Add topic