Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Become a Premium Member and unlock a new, free course in leading technologies each month.

Solved

Posted on 2010-08-30

Suppose X is a uniform random variable in the interval [0,1), how do I transform it so as to form a Gaussian distribution?

Thanks

Thanks

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

- Help others & share knowledge
- Earn cash & points
- Learn & ask questions

4 Comments

http://www.bearcave.com/misl/misl_tech/wavelets/hurst/random.html

http://www.taygeta.com/random/gaussian.html

But here are the details you want:

You call your random number X, int he code below, each call to randf() returns another pseudorandom number. If you're not used to c programming, note the the point of the

do {...} while while ( w >= 1.0 );

part is to keep trying the {..} portion until you get a w<1. Once you have x1 and x2 that result in w<1, then you use them to calculate the Gaussina-distributed pseudorandom number y1.

```
// from http://www.taygeta.com/random/gaussian.html
// Algorithm by Dr. Everett (Skip) Carter, Jr.
float x1, x2, w, y1, y2;
do {
x1 = 2.0 * ranf() - 1.0;
x2 = 2.0 * ranf() - 1.0;
w = x1 * x1 + x2 * x2;
} while ( w >= 1.0 );
w = sqrt( (-2.0 * ln( w ) ) / w );
y1 = x1 * w;
```

http://en.wikipedia.org/wiki/Normal_distribution#Generating_values_from_normal_distribution

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Course of the Month13 days, 15 hours left to enroll

Join the community of 500,000 technology professionals and ask your questions.