How To Sample Random Numbers

  • Thread starter Watts
  • Start date
  • #1
38
0

Main Question or Discussion Point

I had a Monte Carlo class many moons ago. I was wondering if some one could jog my memory on how to sample random numbers from a normal distribution. I could do it but the normal distributions CDF is a non elementary integral. I cant get past that part.
 

Answers and Replies

  • #2
EnumaElish
Science Advisor
Homework Helper
2,304
124
Let U1 and U2 be two independent uniforrm random variables over the unit square. Then two independent standard normal random variables can be generated as [itex]N_1 = \sqrt{-2 \log (U_1)} \sin (2\pi U_2)[/itex] and [itex]N_2 = \sqrt{-2 \log (U_1)} \cos (2\pi U_2)[/itex].

P.S. Any software with an intrinsic normal distribution function will also do the trick.
 
Last edited:
  • #3
38
0
Explain

Explain intrinsic normal distribution function(the intrinsic part).
 
Last edited:
  • #4
lurflurf
Homework Helper
2,423
123
Watts said:
I had a Monte Carlo class many moons ago. I was wondering if some one could jog my memory on how to sample random numbers from a normal distribution. I could do it but the normal distributions CDF is a non elementary integral. I cant get past that part.
The obvious method would be to generate uniform ramdon numbers on [0,1] then invert the normal CDF, but that is not computationally practical. What is often done is using the law of large numbers. The average of a large number of nonpathological random variables will be normal. Uniform randoms on [0,1] work well and are often the basis for other distributions. Also as was mentioned one could use a program/library that includes a random normal generator.
 
  • #5
HallsofIvy
Science Advisor
Homework Helper
41,770
911
Watts said:
Explain intrinsic normal distribution function(the intrinsic part).
"Intrinsic" here just means that the software has a built in function that will calculate the normal distribution for you.
 

Related Threads for: How To Sample Random Numbers

Replies
2
Views
2K
Replies
3
Views
562
  • Last Post
Replies
5
Views
639
  • Last Post
Replies
2
Views
2K
Replies
5
Views
1K
  • Last Post
Replies
7
Views
2K
  • Last Post
Replies
4
Views
2K
Replies
1
Views
118
Top