Unbias a random generator: Difference between revisions

Content added Content deleted
(→‎{{header|PARI/GP}}: Marked incomplete as missing the randN column)
Line 653: Line 653:


=={{header|PARI/GP}}==
=={{header|PARI/GP}}==
{{incomplete|PARI/GP|"For N over its range, generate and show counts of the outputs of randN and unbiased(randN)". Missing the randN column}}
GP's random number generation is high-quality, using Brent's [http://maths.anu.edu.au/~brent/random.html XORGEN]. Thus this program is slow: the required 400,000 unbiased numbers generated through this bias/unbias scheme take nearly a second.
GP's random number generation is high-quality, using Brent's [http://maths.anu.edu.au/~brent/random.html XORGEN]. Thus this program is slow: the required 400,000 unbiased numbers generated through this bias/unbias scheme take nearly a second.
<lang parigp>randN(N)=!random(N);
<lang parigp>randN(N)=!random(N);