Random numbers: Difference between revisions

→‎{{header|PARI/GP}}: one programming error corrected, visual check of improve of distribution. No further tests.
(→‎{{header|PARI/GP}}: one programming error corrected, visual check of improve of distribution. No further tests.)
Line 1,878:
<lang parigp>rnormal()={
my(pr=32*ceil(default(realprecision)*log(10)/log(4294967296)),u1=random(2^pr)*1.>>pr,u2=random(2^pr)*1.>>pr);
sqrt(-2*log(u1))*cos(2*Pi*u1u2) \\ in previous version "u1" instead of "u2" was used --> has given crap distribution
\\ Could easily be extended with a second normal at very little cost.
};
Anonymous user