Created
October 6, 2013 01:15
-
-
Save daeken/6848101 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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