title: What is the expected number of biased coin tosses for this algorithm?
body: <p>Suppose I have a biased coin. When flipped, the probability of yielding heads is 4/5.</p>
  
  <p>To fake a fair toss, I pursue the following algorithm that models this situation. Suppose <code>True</code> models heads, and <code>False</code> represents tails.</p>
  
  <p>P(doUnfairFlip() = 0) = 0.8 <br>
  and <br>
  P(doUnfairFlip() = 1) = 0.2</p>
  
  <pre><code>def fakeFairToss():
      flip1 = 0
      flip2 = 0
      while (flip1 == flip2):
          flip1 = doUnfairFlip()
          flip2 = doUnfairFlip()
      return (True if (flip1 == 0) else False)
  </code></pre>
  
  <p>It makes use of the fact that one is equally likely to get a heads-tails or a tails-heads after two coin flips.</p>
  
  <p>How many individual flips of this biased coin should I expect every time this function runs?</p>