How To Sample Random Numbers

In summary: So instead of having to manually calculate the CDF or use the law of large numbers, the software will do it for you, making it much more efficient and practical. This function is often included in statistics or data analysis software, and it allows you to easily generate random numbers from a normal distribution without having to do any complicated math.
  • #1
Watts
38
0
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 can't get past that part.
 
Physics news on Phys.org
  • #2
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
Explain

Explain intrinsic normal distribution function(the intrinsic part).
 
Last edited:
  • #4
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 can't 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
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.
 

1. What is the purpose of sampling random numbers?

The purpose of sampling random numbers is to generate a set of numbers that are representative of a larger population. This can be useful in statistical analysis, simulation and modeling, and other scientific experiments.

2. How do you ensure that random numbers are truly random?

To ensure that random numbers are truly random, it is important to use a reliable and unbiased random number generator. This can be achieved by using a physical source of randomness, such as atmospheric noise or radioactive decay, or by using a computer algorithm designed specifically for generating random numbers.

3. Is there a difference between pseudo-random and truly random numbers?

Yes, there is a difference between pseudo-random and truly random numbers. Pseudo-random numbers are generated by a computer algorithm and may appear random, but they are actually predetermined based on a starting value called a seed. Truly random numbers, on the other hand, are generated from a physical source of randomness and are not predetermined.

4. Can you explain the concept of sampling distribution in relation to random numbers?

The sampling distribution is a theoretical distribution that represents the possible outcomes of a random sampling process. In the context of random numbers, the sampling distribution refers to the distribution of numbers that are generated from a population using a random sampling method. This distribution can help us understand the characteristics of the population and make inferences about it.

5. How can you use random numbers in scientific experiments?

Random numbers can be used in scientific experiments in a variety of ways. They can be used to randomly assign participants to different groups, to select a random sample from a larger population, or to generate random conditions for testing. They can also be used in simulations and modeling to mimic real-world scenarios and test different hypotheses.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
6
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
918
  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
464
  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
337
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
899
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
6
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
843
  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
24
Views
3K
Back
Top