Contents
- 1 How do you generate such a random number if you are given a coin with unknown bias?
- 2 How do you create a fair probability using a biased coin?
- 3 How can you use a biased coin to make an unbiased decision?
- 4 How to make a biased coin from a coin?
- 5 How to make a coin with equal probability?
- 6 What do you mean by unbiased coin toss?
How do you generate such a random number if you are given a coin with unknown bias?
One way to generate such a random variable is to:
- Toss the coin twice.
- If the result is HT, assign X=0. If the result is TH, assign X=1.
- If the result is either HH or TT, then discard the two coin tosses and go to step 1.
How do you create a fair probability using a biased coin?
Riddler Classic. Mathematician John von Neumann is credited with figuring out how to take a biased coin (whose probability of coming up heads is p, not necessarily equal to 0.5) and “simulate” a fair coin. Simply flip the coin twice. If it comes up heads both times or tails both times, then flip it twice again.
How can you use a biased coin to make an unbiased decision?
How can you use a biased coin to make an unbiased decision? That is to say the coin does not give heads or tales with equal probability….Von Neumann wrote it like this:
- Toss the coin twice.
- If the results match, start over, forgetting both results.
- If the results differ, use the first result, forgetting the second.
What is biased coin randomization?
So instead of giving the patient a 50:50 chance of being in treatment or control, randomization uses the “biased coin”: the computer selects a random number between 0 and 1 and if this is less than, say, 0.6 (rather than 0.5 as usual), the patient is assigned to control.
Can you get a biased coin?
Coin tosses can be biased only if the coin is allowed to bounce or be spun rather than sim- ply ipped in the air.
How to make a biased coin from a coin?
You are given a function foo () that represents a biased coin. When foo () is called, it returns 0 with 60% probability, and 1 with 40% probability. Write a new function that returns 0 and 1 with a 50% probability each. Your function should use only foo (), no other library method.
How to make a coin with equal probability?
So the two cases appear with equal probability. The idea is to return consider only the above two cases, return 0 in one case, return 1 in other case. For other cases [ (0, 0) and (1, 1)], recur until you end up in any of the above two cases.
What do you mean by unbiased coin toss?
When we talk about a coin toss, we think of it as unbiased: with probability one-half it comes up heads, and with probability one-half it comes up tails. An ideal unbiased coin might not correctly model a real coin, which could be biased slightly one way or another. After all, real life is rarely fair.
Which is the easiest way to generate a random number?
If b-a is not a power of 2 then you may have to flip many coins in order to get a result. You may even never get a result, but that is unlikely in the extreme. The simplest method is to generate a number in [a, a+2^n), where 2^n >= b-a, until one happens to land in [a, b).