Random Number Generation Question

Click For Summary
SUMMARY

The discussion focuses on using the rejection method for random number generation based on a given probability table. The probability distribution for X is defined as P(X) = {0.4, 0.25, 0.25, 0.1} for values {1, 2, 3, 4}. A participant clarifies the method of generating random numbers by transforming random values into integers and accepting them based on their probabilities. The consensus is to adjust the generated values by adding 1 to ensure the output aligns with the desired range of {1, 2, 3, 4}.

PREREQUISITES
  • Understanding of probability distributions and their applications
  • Familiarity with the rejection sampling method
  • Basic knowledge of random number generation techniques
  • Ability to work with probability tables and transformations
NEXT STEPS
  • Study the rejection sampling method in detail
  • Learn about probability distributions and their properties
  • Explore integer transformation techniques in random number generation
  • Investigate other random number generation methods such as inverse transform sampling
USEFUL FOR

Students, statisticians, and programmers interested in random number generation techniques, particularly those utilizing probability distributions and the rejection method.

Pyroadept
Messages
82
Reaction score
0

Homework Statement




Consider the following probability table:
X 1 2 3 4
P(X) 0.4 0.25 0.25 0.1

Use the rejection method to generate a random number.

Use the following list of random numbers:
0.6072, 0.4893, 0.0899, 0.3456, 0.4419, 0.4694, 0.3134, 0.6266, 0.4424

If you run out of numbers, start again.




Homework Equations





The Attempt at a Solution



Hi everyone,

So I know how to do this (let X_C = INT(4*R_1), where R_1 is one of the random numbers, and then accept if P(X_C) > R_2, where R_2 is the next random number in the sequence.

My question is this though - in all the examples I can find of this kind of method, one of the values of X is always 0 to accommodate for X_C's that are less than 1. Also, under this method as above, it would be impossible to ever generate 4. So should I shift all the numbers down one? As in make 1=0, 2=1, 3=2 and 4=3, for the purposes of calculating the random numbers?

Thanks for any help!
 
Physics news on Phys.org
Yes, the numbers you want to get are 1, 2, 3, 4 and your method gives, instead, 0, 1, 2, 3. Just add 1 to whatever number you get.
 
Thanks :)
 

Similar threads

Replies
9
Views
4K
Replies
8
Views
1K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
Replies
3
Views
1K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 5 ·
Replies
5
Views
2K
Replies
5
Views
4K
Replies
2
Views
1K
  • · Replies 6 ·
Replies
6
Views
3K