5 lines
276 B
Text
5 lines
276 B
Text
fcn mkRand(mean,sd){ //normally distributed random w/mean & standard deviation
|
||
pi:=(0.0).pi; // using the Box–Muller transform
|
||
rz1:=fcn{1.0-(0.0).random(1)} // from [0,1) to (0,1]
|
||
return('wrap(){((-2.0*rz1().log()).sqrt() * (2.0*pi*rz1()).cos())*sd + mean })
|
||
}
|