PDA

View Full Version : Generating normally distributed random numbers in C++




vgoklani
Mar 9, 2007, 09:26 AM
Hi,

I would like to generate normally distributed (as opposed to uniformly distributed) random numbers in C++ - is there a library function that would accomplish this? I am using the g++ compiler that comes installed with XCode.



Eraserhead
Mar 9, 2007, 09:56 AM
Hi,

I would like to generate normally distributed (as opposed to uniformly distributed) random numbers in C++ - is there a library function that would accomplish this? I am using the g++ compiler that comes installed with XCode.

Hmm, you could easily write your own code.

Look at this page (http://emme2.spiess.ch/e2news/news14/node4.html). It gives a formula for how to do it.

vgoklani
Mar 9, 2007, 11:23 AM
I thought about using Numerical Recipes, but thanks for the link!