What's the best way to generate normally distributed random numbers in C?

I need to use normally distributed random numbers in my program. Let's say I need to generate x (size R ^ (mxn)) whose elements are Gaussian distribution of zero mean and one variance. How do I do this in C with good precision?

+3


source to share


1 answer


There are many algorithms for generating a normal distribution if you have a uniform random generator. Check out this section of the wikipedia article. One possible approach is to use the central limit theorem . The approach here would be to generate a set of evenly distributed integers and then compute their arithmetic mean.



+1


source







All Articles