I\'m trying to use the C++ STD TechnicalReport1 extensions to generate numbers following a normal distribution, but this code (adapted from this article):
If your TR1 random number generation implementation is buggy, you can avoid TR1 by writing your own normal generator as follows.
Generate two uniform (0, 1) random samples u and v using any random generator you trust. Then let r = sqrt( -2 log(u) ) and return x = r sin(2 pi v). (This is called the Box-Mueller method.)
If you need normal samples samples with mean mu and standard deviation sigma, return sigma*x + mu instead of just x.