Skip to content

Instantly share code, notes, and snippets.

@ruescasd
Created December 28, 2015 11:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruescasd/44c9e26ca3a5bbbd99c3 to your computer and use it in GitHub Desktop.
Save ruescasd/44c9e26ca3a5bbbd99c3 to your computer and use it in GitHub Desktop.
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