Stated another way, the algorithm for getting an unbiased bit from a biased coin is:
1. Flip the coin twice.
2. If it's both heads or both tails, discard result and go back to 1.
3. If it's heads then tails, result = 0
4. If it's tails then heads, result = 1