You say you want a generator for normally distributed (Gaussian) random numbers from 0 to 1.
First of all, the normal distribution is not limited ... the function that you show in your example generates normally distributed random numbers with an average of 0.0 and a standard deviation of 1.0
You can generate normally distributed random values โโof any mean and standard deviation by multiplying the value you get from this function by the desired standard deviation, and then add the desired mean value ...
The code is in order as it is - the problem is a misunderstanding of the Gaussian (normal) distribution, which has a range from -inf to + inf ...
at about 2/3 of the time when the value you get will be between the standard deviation +/- 1 ... in about 95% of cases the value will be between + / 1 3 times the standard deviation ...
MaxCulpa
source share