Generating normally distributed random numbers in C++

Discussion in 'Mac Programming' started by vgoklani, Mar 9, 2007.

  1. macrumors regular

    vgoklani

    Joined:
    Jul 2, 2004
    #1
    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.
     
  2. macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #2
    Hmm, you could easily write your own code.

    Look at this page. It gives a formula for how to do it.
     
  3. thread starter macrumors regular

    vgoklani

    Joined:
    Jul 2, 2004
    #3
    I thought about using Numerical Recipes, but thanks for the link!
     

Share This Page