Re:Show HN: Deck of Cards – A playing card API
by hurin on Sunday May 10, 2015 @11:51PM
(#9522602)
Seriously, why wouldn't you just use a local RNG? Do you realize it's actually less work than reading API documentation?
[ Parent
| on HN ]
Re:Show HN: Deck of Cards – A playing card API
by crobertsbmw on Monday May 11, 2015 @12:11AM
(#9522652)
Consider it a bad Rube Goldberg Machine.
numbers = ['2','3','4','5','6','7','8','9','10','J','K','Q','A']
suits = ['CLUBS', 'SPADES', 'HEARTS', 'DIAMONDS']
deck = [(num,suit) for num in numbers for suit in suits]
random.shuffle(deck)
draw_card = lambda deck: deck.pop()