Normal Distribution random number generator

Discussion in 'C++' started by Tan Thuan Seah, Oct 12, 2004.

  1. Hi all,

    I am looking for a way to generate a random number given the variance of a
    gaussian distribution(or normal distribution). The mean is 0 but the
    variance will be a user input. Does C++ have any of this sort of generator
    available? Or must I use some transformation to get a random number from a
    standardised normal distribution and map it to my distribution? Any link and
    references are welcome.

    Thuan Seah
     
    Tan Thuan Seah, Oct 12, 2004
    #1
    1. Advertising

  2. "Tan Thuan Seah" <> wrote in message
    news:...
    > Hi all,
    >
    > I am looking for a way to generate a random number given the variance of

    a
    > gaussian distribution(or normal distribution). The mean is 0 but the
    > variance will be a user input. Does C++ have any of this sort of generator
    > available? Or must I use some transformation to get a random number from a
    > standardised normal distribution and map it to my distribution? Any link

    and
    > references are welcome.


    You can get a full implementation in Java from the Sun site (download their
    SDK which includes source) or e-mail me and I'll send you the code.
    It is relatively clean, and I think pretty easy to translate to C++. They
    implement Knuth, ACP, Section 3.4.1 Algorithm C.
    There may be other versions on the web.
    --
    Gary
     
    Gary Labowitz, Oct 12, 2004
    #2
    1. Advertising

  3. Tan Thuan Seah

    Kai-Uwe Bux Guest

    Tan Thuan Seah wrote:

    > Hi all,
    >
    > I am looking for a way to generate a random number given the variance of
    > a
    > gaussian distribution(or normal distribution). The mean is 0 but the
    > variance will be a user input. Does C++ have any of this sort of generator
    > available? Or must I use some transformation to get a random number from a
    > standardised normal distribution and map it to my distribution? Any link
    > and references are welcome.


    Check out the Boost libraries. It has an impressive set of high quality
    random number generators for various distributions, including the normal
    distribution. I think, mean and standard deviation can be specified but
    default to 0 and 1.


    Best

    Kai-Uwe Bux
     
    Kai-Uwe Bux, Oct 12, 2004
    #3
  4. Tan Thuan Seah

    Cy Edmunds Guest

    "Tan Thuan Seah" <> wrote in message
    news:...
    > Hi all,
    >
    > I am looking for a way to generate a random number given the variance of

    a
    > gaussian distribution(or normal distribution). The mean is 0 but the
    > variance will be a user input. Does C++ have any of this sort of generator
    > available? Or must I use some transformation to get a random number from a
    > standardised normal distribution and map it to my distribution? Any link

    and
    > references are welcome.
    >
    > Thuan Seah
    >
    >


    Follow my sig and look for UVS.

    --
    Cy
    http://home.rochester.rr.com/cyhome/
     
    Cy Edmunds, Oct 14, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Yudan YI \(OSU\)
    Replies:
    5
    Views:
    16,318
    Dietmar Kuehl
    Feb 25, 2005
  2. PCHOME
    Replies:
    3
    Views:
    2,169
    Lawrence Kirby
    Jun 23, 2005
  3. Verbal Kint
    Replies:
    10
    Views:
    645
    Keith Thompson
    Jun 30, 2007
  4. globalrev
    Replies:
    4
    Views:
    772
    Gabriel Genellina
    Apr 20, 2008
  5. Luca Cerone
    Replies:
    29
    Views:
    1,369
    lucacerone
    Feb 21, 2012
Loading...

Share This Page