I am allowed to make any number of coin tosses. Coin is unbiased. How can I generate a given random variable X (say X is bernouille or binomial or uniform) using independent coin tosses. I am looking at this direction. Given X a random variable, I have to conduct an m coin tosses experiment for some m such that we associate X=i to some event say E_i in the experiment such that probability of occurrence of the event E_i is same as that of p(X=i) for each possible value i that X takes.
Can you help me how to generate random variable say bernouille (p)/binomial (n,p) at least using coin tosses.