Skip to content

Instantly share code, notes, and snippets.

@daeken
Created October 6, 2013 01:15
Show Gist options
  • Select an option

  • Save daeken/6848101 to your computer and use it in GitHub Desktop.

Select an option

Save daeken/6848101 to your computer and use it in GitHub Desktop.
from random import randrange as rand
nonlands = 53
lands = 28
total = nonlands + lands
print 'Total cards:', total
tlands = 0
samples = 100000
for i in xrange(samples):
l, nl = lands, nonlands
for x in xrange(10):
if rand(l+nl) < l:
tlands += 1
l -= 1
else:
nl -= 1
print 'Average lands per first 10 cards:', tlands / float(samples)
print 'Naively expected:', float(lands) / (lands + nonlands) * 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment