Random numbers: Difference between revisions
Added XPL0 example.
m (→{{header|Chipmunk Basic}}: Ending tag corrected.) |
(Added XPL0 example.) |
||
Line 2,802:
Actual std dev: 0.4961645117026
</pre>
=={{header|XPL0}}==
{{trans|C}}
<syntaxhighlight lang "XPL0">define PI = 3.14159265358979323846;
func real DRand; \Uniform distribution, [0..1]
return float(Ran(1_000_000)) / 1e6;
func real RandomNormal; \Normal distribution, centered on 0, std dev 1
return sqrt(-2.*Log(DRand)) * Cos(2.*PI*DRand);
int I;
real Rands(1000);
for I:= 0 to 1000-1 do
Rands(I):= 1.0 + 0.5*RandomNormal</syntaxhighlight>
=={{header|Yorick}}==
|