# [MATRIX-SIG] random.gauss isn't Gaussian

**Konrad Hinsen
**
hinsen@ibs.ibs.fr

*Sat, 31 Jan 1998 22:14:40 +0100*

>* I've been doing some monte carlo studies with python (monte
*>* python calculations actually) and have found rather weird
*>* distributions when using random.gauss. Contrary to what the
*>* docs say, it does not generate a normal distribution.
*
Indeed. And it's not just a bug in the code; the formula given in the
comment is already wrong! Badly wrong, in fact. It generates an
exponential distribution and then pretends it's a Gaussian!
On the other hand, random.normalvariate() does work. However, it
is a bit slow if you need plenty of random numbers. You should
try my enhanced version of Paul Dubois' random number generator;
it also has a normal distribution, which works and is fast.
You can pick it up at
http://starship.skyport.net/crew/hinsen/RNGmodule.tar.gz
--
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire | Tel.: +33-4.76.88.99.28
Institut de Biologie Structurale | Fax: +33-4.76.88.54.94
41, av. des Martyrs | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France | Nederlands/Francais
-------------------------------------------------------------------------------
_______________
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________