Created
December 28, 2015 11:33
-
-
Save ruescasd/44c9e26ca3a5bbbd99c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy.random as npr | |
SIZE=3030 | |
LOOPS=1000000 | |
TIE=SIZE/2 | |
ties=0 | |
for i in range(1, LOOPS): | |
p = npr.random() | |
a =[ 1 if npr.random()>p else 0 for x in xrange(SIZE)] | |
if sum(a) == TIE: | |
ties += 1 | |
if i % 1000 == 0: | |
print("Total: {} ties: {} prob: {}".format(i, ties, ties/float(i))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment