The Normal (or Gaussian) distribution is a frequently used distribution in statistics. While most programming languages provide a uniformly distributed random number generator, one can derive normally distributed random numbers from a uniform generator.



The task

 Take a uniform random number generator and create a large (you decide how large) set of numbers that follow a normal (Gaussian) distribution. Calculate the dataset's mean and standard deviation, and show a histogram of the data.
 Mention any native language support for the generation of normally distributed random numbers.


Reference

 You may refer to code in Statistics/Basic if available.


from __future__ import division
import matplotlib.pyplot as plt 
import random
 
mean, stddev, size = 50, 4, 100000
data = [random.gauss(mean, stddev) for c in range(size)]
 
mn = sum(data) / size
sd = (sum(x*x for x in data) / size 
      - (sum(data) / size) ** 2) ** 0.5
 
print("Sample mean = %g; Stddev = %g; max = %g; min = %g for %i values" 
      % (mn, sd, max(data), min(data), size))
 
plt.hist(data,bins=50)