## Joint Distribution of discrete random variables homework problem

Hi, I have a homework question as follows:

-----------------------------
X and Y are discrete random variables with joint frequency function p_xy, conditional frequency function p_x|y and marginal frequency functions p_x, p_y. Let y_0 be a number for which p_y(y_0)>0.
a.) Draw an X_i from p_x
b.) Draw an R_i (from {0,1}) with the probability of success, p=p_y|x(y_0|x_i)
c.) If R_i=1, set Z=X_i and stop.