# Generating a number belonging to N(0,1) using *m* numbers from U(0,1) using central limit theorem

I was going through a blog which details how to generate a multivariate Gaussian vector, given a mean vector μ and co-variance matrix σ.

As a starting point, author uses generated uniform random numbers to simulate Gaussian random numbers using central limit theorem. The relevant extract from the blog is below:

Let's say you generate m uniform random numbers (each between 0 and 1) and you use the variable xi to denote each of these. The Central Limit Theorem allows us to convert these m numbers belonging to U(0,1) into a single number that belongs to the Guassian distribution N(0,1).

$$x = \frac{\sum_ix_i-\frac{m}{2}}{\sqrt{\frac{m}{12}}}$$

Here, x is a one dimensional Gaussian random number - produced using the help of m uniform random variables. The $$\frac{m}{2}$$ is derived from the term mμu (where μu is the mean of the uniform distribution - $$\frac{1-0}{2} = 0.5$$). The denominator is derived from the term σ$$\sqrt{m}$$ where $$\sigma^2$$ is the variance of the uniform distribution between 0 and 1 (comes to exactly $$\frac{1}{12}$$).

Link to the article : http://www.aishack.in/tutorials/generating-multivariate-gaussian-random/

I wanted to understand the details of the underlying math as I am not sure how central limit theorem is used to generate N(0,1) number from m U(0,1) numbers. I googled the same but was not able to find an explanation for this.

The idea is that the if there are $$m$$ independent random variables $$X_i$$ each uniformly distributed on $$[0,1]$$, so with mean $$\frac12$$ and variance $$\frac1{12}$$, then their sum $$S_m$$ has mean $$\frac{m}2$$ and variance $$\frac{m}{12}$$ while their average $$\frac1m S_m$$ has mean $$\frac{1}2$$ and variance $$\frac{1}{12m}$$
The Central Limit theorem says that $$\sqrt{m}\left(\frac1m S_m - \frac{1}2\right)$$ converges in distribution to $$\mathcal N\left(0,\frac1{12}\right)$$, i.e. $$\dfrac{ S_m - \frac{m}2}{\sqrt{\frac{m}{12}}}$$ converges in distribution to $$\mathcal N(0,1)$$ as $$m$$ increases
So for sufficiently large $$m$$, you might use $$\dfrac{ S_m - \frac{m}2}{\sqrt{\frac{m}{12}}}$$ to generate a random variable which has a distribution close to that of a standard normal random variable