Debt deflation: Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>GliderMaven
ref from Steve Keen
en>Pass3456
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
The '''Lehmer random number generator'''<ref>{{cite journal | author=W.H. Payne, J.R. Rabung, T.P. Bogyo |title=Coding the Lehmer pseudo-random number generator |journal=[[Communications of the ACM]] |year=1969 |volume=12 |issue=2 |pages=85–86 |url=http://www.firstpr.com.au/dsp/rand31/p85-payne.pdf |doi=10.1145/362848.362860}}</ref> (named after [[D. H. Lehmer]]), sometimes also referred to as the '''Park–Miller random number generator''' (after Stephen K. Park and Keith W. Miller), is a variant of [[linear congruential generator]] (LCG) that operates in [[multiplicative group of integers modulo n]]. A general formula of a random number generator (RNG) of this type is:
Hi there! :) My name is Carma, I'm a student studying Arts from Cagliari, Italy.<br><br>Feel free to visit my homepage; [http://peak.hosting.bizfree.kr/xe/?document_srl=225651 wordpress backup plugin]
 
: <math>X_{k+1} = g \cdot X_k~~\bmod~~n</math>
 
where the modulus ''n'' is a [[prime number]] or a power of a prime number, the multiplier ''g'' is an element of high [[multiplicative order]] modulo ''n'' (e.g., a [[primitive root modulo n]]), and the seed ''X''{{sub|0}} is [[coprime|co-prime]] to ''n''.
 
== Parameters in common use ==
 
In 1988, Park and Miller<ref>{{cite journal | author=Stephen K. Park and Keith W. Miller |title=Random Number Generators: Good Ones Are Hard To Find |journal=[[Communications of the ACM]] |year=1988 |volume=31 |issue=10 |pages=1192–1201 |url=http://www.firstpr.com.au/dsp/rand31/p1192-park.pdf |doi=10.1145/63039.63042}}</ref> suggested a Lehmer RNG with particular parameters ''n'' = 2{{sup|31}} − 1 = 2,147,483,647 (a [[Mersenne prime]] ''M''{{sub|31}}) and ''g'' = 7{{sup|5}} = 16,807 (a primitive root modulo ''M''{{sub|31}}), now known as '''MINSTD'''. Although MINSTD was later criticized by Marsaglia and Sullivan,<ref>{{cite journal |title=Technical correspondence |journal=[[Communications of the ACM]] |year=1993 |volume=36 |issue=7 |pages=105–110 |doi=10.1145/159544.376068 |author=Crawford, Diane}}</ref> it is still in use today (in particular, in [[CarbonLib]] and [[C++11]]'s <code>minstd_rand0</code>). The authors responded to criticism in 1993,<ref>{{cite journal | author= Stephen K. Park and Keith W. Miller and Paul K. Stockmeyer |title=Technical Correspondence |journal=[[Communications of the ACM]] |year=1988 |volume=36 |issue=7 |pages=105–110 |doi=10.1145/159544.376068}}</ref> saying:
<blockquote>
Given the dynamic nature of the area, it is difficult for nonspecialists to make decisions about what generator to use. "Give me something I can understand, implement and port... it needn't be state-of-the-art, just make sure it's reasonably good and efficient." Our article and the associated minimal standard generator was an attempt to respond to this request. Five years later, we see no need to alter our response other than to suggest the use of the multiplier a = 48271 in place of 16807.
</blockquote>
This revised constant is used in  [[C++11]]'s <code>minstd_rand</code> random number generator.
 
[[ZX Spectrum]] uses the Lehmer RNG with parameters ''n'' = 2{{sup|16}} + 1 = 65,537 (a [[Fermat prime]] ''F''{{sub|4}}) and ''g'' = 75 (a primitive root modulo ''F''{{sub|4}}). The [[CRAY]] random number generator '''RANF''' is a Lehmer RNG with ''n'' = 2{{sup|48}} and ''g'' = 44,485,709,377,909.<ref name="gnu">[http://www.gnu.org/software/gsl/manual/html_node/Other-random-number-generators.html GNU Scientific Library: Other random number generators]</ref> Another popular pair of parameters is ''n'' = 2{{sup|32}} − 5 = 4,294,967,291 and ''g'' = 279,470,273.{{Citation needed|date=April 2010}}
 
The [[GNU Scientific Library]] includes several random number generators of the Lehmer form, including MINSTD, RANF, and the infamous [[IBM]] random number generator [[RANDU]].<ref name="gnu" />
 
== Relation to LCG ==
 
While the Lehmer RNG can be viewed as a particular case of the [[linear congruential generator]] with {{gaps|''c''|{{=}}|0}}, it is a special case that implies certain restrictions and properties. In particular, for the Lehmer RNG, the initial seed ''X''{{sub|0}} must be [[coprime]] to the modulus ''n'' that is not required for LCGs in general. The choice of the modulus ''n'' and the multiplier ''g'' is also more restrictive for the Lehmer RNG. In contrast to LCG, the maximum period of the Lehmer RNG equals ''n''−1 and it is such when ''n'' is prime and ''g'' is a primitive root modulo ''n''.
 
On the other hand, the [[discrete logarithm]]s (to base ''g'' or any primitive root modulo ''n'') of ''X{{sub|k}}'' in <math>\mathbb{Z}_n</math> represent linear congruential sequence modulo [[Euler totient]] <math>\varphi(n)</math>.
 
== Sample C99 code ==
 
Using [[ISO C|C]] code, the Lehmer generator using the "popular pair" of parameters mentioned above can be written as follows:
 
<source lang="c">
uint32_t lcg_rand(uint32_t a)
{
    return ((uint64_t)a * 279470273UL) % 4294967291UL;
}
</source>
As the product of two 32 bit integers may overflow, the cast to uint64_t is necessary.
 
== References ==
 
{{reflist|2}}
 
* {{cite journal |author=Lehmer, D. H. |title=Mathematical methods in large-scale computing units |journal=Proceedings of a Second Symposium on Large-Scale Digital Calculating Machinery |year=1949 |pages=141–146 |mr=0044899}} (journal version: ''Annals of the Computation Laboratory of Harvard University'', Vol. 26 (1951)).
* {{cite journal |author=Martin Greenberger |title=Notes on a New Pseudo-Random Number Generator |journal=Journal of the ACM |volume=8 |issue=2 |year=1961 |pages=163–167 |doi=10.1145/321062.321065}}
* Steve Park, [http://www.cs.wm.edu/~va/software/park/ Random Number Generators]
* [http://www.firstpr.com.au/dsp/rand31/ Park–Miller–Carta Pseudo-Random Number Generator]
 
[[Category:Pseudorandom number generators]]
[[Category:Modular arithmetic]]

Latest revision as of 00:11, 10 January 2015

Hi there! :) My name is Carma, I'm a student studying Arts from Cagliari, Italy.

Feel free to visit my homepage; wordpress backup plugin