Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

vgoklani

macrumors regular
Original poster
Jul 2, 2004
186
0
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

macrumors G4
Nov 3, 2005
10,434
12,250
UK
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. It gives a formula for how to do it.
 

vgoklani

macrumors regular
Original poster
Jul 2, 2004
186
0
I thought about using Numerical Recipes, but thanks for the link!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.