Q:

Random Number Generator Explanation

from random import *
def main():
    t = 0
    for i in range(1000):  # thousand
        t += random()
    print(t/1000)
main()

I was looking at the source code for a sample program my professor gave me and I came across this RNG. can anyone explain how this RNG works? 

A:

If you plotted the points, you would see that this actually produces a Gaussian ("normal") distribution about the mean of the random function. 

Generate random numbers following a normal distribution in C/C++ talks about random number generation; it's a pretty common technique to do this if all you have is a uniform number generator like in standard C.
What I've given you here is a histogram of 100,000 values drawn from your function (of course, returned not printed, if you aren't familiar with python). The y axis is the frequency that the value appears, the x axis is the bin of the value. As you can see, the average value is 1/2, and by 3 standard deviations (99.7 percent of the data) we have almost no values in the range. That should be intuitive; we "usually" get 1/2, and very rarely get .99999

