Solved

Gaussian distributed pseudorandom number generator

Posted on 2010-08-30
4
555 Views
Last Modified: 2013-11-13
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
0
Comment
Question by:InteractiveMind
4 Comments
 
LVL 73

Assisted Solution

by:sdstuber
sdstuber earned 50 total points
ID: 33561993
easiest way is to probably to sum groups of the random  numbers.  The central limit theorem dictates the sums should be a normal distribution
0
 
LVL 32

Accepted Solution

by:
phoffric earned 200 total points
ID: 33561994
0
 
LVL 2

Assisted Solution

by:wslb
wslb earned 50 total points
ID: 33569444
As phoffric (give him most of the credit) says, http://www.bearcave.com/misl/misl_tech/wavelets/hurst/random.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;

Open in new window

0
 
LVL 4

Assisted Solution

by:boocko
boocko earned 200 total points
ID: 33584092
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error in calculation 2 60
Homework Help 5 73
finding artist from picture(portrait) 5 89
One Standard Deviation from the Mean 2 13
Article by: Nicole
This is a research brief on the potential colonization of humans on Mars.
Lithium-ion batteries area cornerstone of today's portable electronic devices, and even though they are relied upon heavily, their chemistry and origin are not of common knowledge. This article is about a device on which every smartphone, laptop, an…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

920 members asked questions and received personalized solutions in the past 7 days.

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

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now