title: Counting random numbers
body: <p>Suppose I repeatedly generate random integers from 0-9 until a given number comes out. What I need is a function that counts how many integers are generated until this happens. Please help me with this.</p>
  
  <p>This is what I have tried, I put 1000 becasue it is big enough but I don't think it is correct because my number can come after 1000 iterations.</p>
  
  <pre><code>for i in range(1000):
    d = randint()
    if d &lt;&gt; 5:
       cnt = cnt + 1
    if d == 5:
       break
  </code></pre>