I am working on a program that uses rand(). I seed it with
and then do some arithmetic to scale rand from [0,RAND_MAX] to [-1,1]. I have generated 100,000 random numbers with this and looked at a histogram and everything looked normal. The problem I am running into is when I sum these values. I keep getting a Gaussian not centered on 0. Does anyone have any ideas why this is happening? Is this the result of a bias in the pseudo-random number generator?Code:srand( (unsigned) time(NULL))
More specifically, I am looking at the distribution of 10,000 sums of 100,000 elements ([-1,1]) each and I get a Gaussian centered at -500 every time I run the program. The sample size I am using shouldn't be an issue. Thanks for the help