Is this python code doing what I want it to do?
<p>I have this code</p>

<pre><code>import random
b = 20
x = random.randrange(0,b)
y = random.randrange(0,b)
ab = 0
xc = 0

while ab != 10:
    if x != y:
        x = random.randrange(0,b)
        y = random.randrange(0,b)
        xc = xc + 1
    elif x == y:
        print ab
        print 'number of tries out of', b, ' : ', xc
        ab = ab + 1
        xc = 0
        y = 999999
</code></pre>

<p>it's essentially a stats program. I want to see out of 10 tries how many times a random number needs to be generated in order to match. So far the numbers i have been getting after running this program i get these values, i ran the program 5 times so that would be a total of 50 tries.</p>

<pre><code>9
26
6
1
5
109
5
42
12
63
</code></pre>

<p>All of those low numbers has led me to wondering if my program is just extremely lucky or if something is wrong my code. Thanks!</p>

<p>Note: is there a way i can get XC to add up after each while loop and when the while loop is true for it to show the total?</p>
