# Generating perfect random gaussian numbers

I tried to generate the series of random numbers with gaussian distribution. So, I used numpy.random.normal(mean,standard deviation,size). However, when I converted these numbers into probabability density function using numpy.histogram, this was not same as Gaussian distribution with same mean and standard deviation made by matplotlib.mlab.normpdf.

I understand it may be because numpy.random.normal is random sampling. So, the PDF of these numbers can't be perfectly Gaussian.

Would you please give any advice about how to get the series of random numbers with mean and standard deviation which would have a Gaussian PDF, if it is possible? The size of the numbers which I tried to get is 660.

I will really appreciate any advice and help.

Best regards,

Isaac

Well, you could "z-score" the sample, by subtracting the sample mean and then dividing by the sample standard deviation:

```x = np.random.normal(0, 1, size=660)
x = (x - x.mean()) / x.std()
```

That will make your vector have a mean of 0 and a standard deviation of 1. But that doesn't mean you will have "perfectly gaussian random numbers." I don't think that's really a concept that makes sense.

It would be helpful to know what application you want to use this for, maybe then it would be easier to suggest alternatives.