![]() |
#7
|
|||
|
|||
![]()
46.311% confirms your other calc with the following more general program:
<font class="small">Code:</font><hr /><pre> from random import * n = 100000 t = 90 k = 52 c = 0 deck = range(52) for j in range(n): m = [False]*52 for i in range(t): d = sample(deck,2) m[d[0]] = True m[d[1]] = True if len(filter(lambda x: x == False, m)) < 2: c += 1 print 1 - float(c)/n </pre><hr /> I traded efficiency for something more readable. Retaining the old approach was workable, but the bit twiddling would have produced an ugly result. |
|
|