On 19/03/16 13:03, Steven D'Aprano wrote: > But all joking aside, Python's pseudo-random number generator is one of > the best in the world, the Mersenne Twister. For non-cryptographical > purposes, it is as random as anything you are likely to need. > > https://en.wikipedia.org/wiki/Mersenne_Twister
But only if you want uniform randomness, for many simulation purposes the distribution needs to be weighted according to some non-linear distribution. For example, when we wrote a lot of network simulators we used Erlang and Poisson distributions. And for pink noise simulations we used Gaussian distributions. You can of course produce those by filtering/weighting the output from a linear distribution but in either case you need to test the relative outputs at sampled slots along the range to ensure the output fits the curve. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor