Skip to content

Instantly share code, notes, and snippets.

@bjhomer
Created October 2, 2012 20:20
Show Gist options
  • Save bjhomer/3823041 to your computer and use it in GitHub Desktop.
Save bjhomer/3823041 to your computer and use it in GitHub Desktop.
drawing cards
import sys
import random
if __name__ == "__main__":
cardcount = int(sys.argv[1])
drawcount = 8
cards_not_seen = set(range(cardcount))
draws = 0
while len(cards_not_seen) > 0:
draws += 1
cards = range(cardcount)
hand = random.sample(cards, drawcount)
print cards_not_seen
for card in hand:
cards_not_seen.discard(card)
print draws
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment