Task

Generate a collection filled with   1000   normally distributed random (or pseudo-random) numbers
with a mean of   1.0   and a   standard deviation   of   0.5



Many libraries only generate uniformly distributed random numbers. If so, you may use one of these algorithms.



Related task

   Standard deviation


include ..\Utilitys.pmt
 
def RandomNormal
    drop rand log -2 * sqrt 2 pi * rand * cos * 0.5 * 1 +
enddef
 
1000 var n
0 n repeat 
 
getid RandomNormal map
 
dup
sum n / var mean
"Mean: " print mean print nl
 
0 swap n for
    get mean - 2 power rot + swap
endfor
swap n / sqrt "Standard deviation: " print print