# Standard Uniform Distibution with Random Variable

Could someone help explain how to solve the following problem:

From my understanding, this problem states that we have a function, Uniform(0, 1), that will generate a random value from 0 to 1 with uniform distribution. What I don't understand is how this translates into the random variable X or the given probability mass function.

• it means that if you have a random number generator which outputs samples from a uniform distribution on $[0,1]$, how do you use that to create another generator which only outputs a $3$ or a $4$ or a $5$ with the probabilities given in the table. – David Holden Oct 6 '14 at 1:30
• Hint: $0.4+0.15+0.45 = 1$ – Graham Kemp Oct 6 '14 at 1:53
• Another hint: Suppose $u \le 0.4$ What value would you assign to $X$? – soakley Oct 11 '14 at 14:56

One approach is to consider the cumulative distribution function $F(x)=P(X \le x)$

So taking a cumulative sum of the probabilities in your table, it might look like

x         3     4     5
P(X=x)   0.40  0.15  0.45
P(X<=x)  0.40  0.55  1.00


Then look at your standard uniform random variable $U$ and

• if $0 \le U \le 0.4$ then set $X=3$
• if $0.4 \lt U \le 0.55$ then set $X=4$
• if $0.55 \lt U \le 1$ then set $X=5$