Skip to content

Instantly share code, notes, and snippets.

@cjhanks
Created December 26, 2013 18:58
Show Gist options
  • Save cjhanks/8137416 to your computer and use it in GitHub Desktop.
Save cjhanks/8137416 to your computer and use it in GitHub Desktop.
probability.py
from copy import copy
from random import shuffle
d = [ 0, 1, 2, 3, 4 ]
T = 0
F = 0
for i in range(0, 10000):
k = copy(d)
shuffle(k)
for q in range(0, 5):
if 0 == len(set(k[q:]) - set(d[q:])):
T += 1
else:
F += 1
print(T / float(T + F))
print(F / float(T + F))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment