[Numpy-discussion] On the quality of the numpy.random.normal() distribution
Wed Dec 10 13:13:52 CST 2008
I think the use of a correct uniform generator will allow a good
normal distribution. Congruental generators are very basic generators,
everyone knows they should not be used. I think Numpy uses a Mersenne
Twisted generator, for which you can generate "independant" vectors
with several hundred values.
2008/12/10 Michael Gilbert <email@example.com>:
> I have been reading that there may be potential issues with the
> Box-Muller transform, which is used by the numpy.random.normal()
> function. Supposedly, since f*x1 and f*x2 are not independent variables, then
> the individual elements (corresponding to f*x1 and f*x2 ) of the
> distribution also won't be independent. For example, see "Stochastic
> Simulation" by Ripley, pages 54-59, where the random values end up
> distributed on a spiral. Note that they mention that they only looked
> at "congruential generators." Is the random number generator used
> by numpy congruential?
> I have tried to generate plots that demonstrate this problem, but have
> come up short. For example:
> import numpy , pylab
> nsamples = 10**6
> n = numpy.random.normal( 0.0 , 1.0 , nsamples )
> pylab.scatter( n[0:-1:2] , n[1:-1:2] , 0.1 )
> I can zoom in and out, and the scatter still looks random (white
> noise -- almost like tv static). Does this prove that there is no
> problem? And if so, why does numpy do a better job than as
> demonstrated by Ripley?
> Mike Gilbert
> Numpy-discussion mailing list
Information System Engineer, Ph.D.
Blogs: http://matt.eifelle.com and http://blog.developpez.com/?blog=92
More information about the Numpy-discussion