This is Argyn's blog. I comment on topics of my interests such as software, math, finance, and music. Also, I write about local events in Northern Virginia, USA and all things related to Kazakhstan

Thursday, February 19, 2009

Not so random

Recently, I was testing one pseudo random number generator (RNG). It generates a sequence of Gaussian random numbers. I suspected that it must suffer from autocorrelation. So, I generated 100,000 numbers, then grouped adjacent numbers into pairs, and got 50,000 pairs (x,y). Each pair corresponds to a point on the plane. Now we can draw a frequency distribution histogram. If certain area on the plain gets more points, then its bar is higher. The graph on the right shows the histogram for this particular RNG. Underneath the histogram, there's a heat map, than more points in the area, then hotter it is. You notice how uneven is the heat map, with 4 hot spots in unexpected places.

For comparison, I show the same graph for a good Gaussian RNG (from Matlab). The histogram has an expected bell-shape, of course. Btw, I'm not endorsing Matlab's RNG, neither I am affiliated with MathWorks in any way :)

No comments: