Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
10
Task/Random-numbers/Pascal/random-numbers.pas
Normal file
10
Task/Random-numbers/Pascal/random-numbers.pas
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
function rnorm (mean, sd: real): real;
|
||||
{Calculates Gaussian random numbers according to the Box-Müller approach}
|
||||
var
|
||||
u1, u2: real;
|
||||
begin
|
||||
u1 := random;
|
||||
u2 := random;
|
||||
rnorm := mean * abs(1 + sqrt(-2 * (ln(u1))) * cos(2 * pi * u2) * sd);
|
||||
/* error !?! Shouldn't it be "mean +" instead of "mean *" ? */
|
||||
end;
|
||||
Loading…
Add table
Add a link
Reference in a new issue