Connecting Tech Pros Worldwide Help | Site Map

Normal Distribution random number generator

Tan Thuan Seah
Guest
 
Posts: n/a
#1: Jul 22 '05
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


Gary Labowitz
Guest
 
Posts: n/a
#2: Jul 22 '05

re: Normal Distribution random number generator


"Tan Thuan Seah" <u2567446@anu.edu.au> wrote in message
news:416b51ec@clarion.carno.net.au...[color=blue]
> Hi all,
>
> I am looking for a way to generate a random number given the variance of[/color]
a[color=blue]
> 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[/color]
and[color=blue]
> references are welcome.[/color]

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


Kai-Uwe Bux
Guest
 
Posts: n/a
#3: Jul 22 '05

re: Normal Distribution random number generator


Tan Thuan Seah wrote:
[color=blue]
> 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.[/color]

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



Cy Edmunds
Guest
 
Posts: n/a
#4: Jul 22 '05

re: Normal Distribution random number generator


"Tan Thuan Seah" <u2567446@anu.edu.au> wrote in message
news:416b51ec@clarion.carno.net.au...[color=blue]
> Hi all,
>
> I am looking for a way to generate a random number given the variance of[/color]
a[color=blue]
> 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[/color]
and[color=blue]
> references are welcome.
>
> Thuan Seah
>
>[/color]

Follow my sig and look for UVS.

--
Cy
http://home.rochester.rr.com/cyhome/


Closed Thread