Created
May 7, 2011 01:57
-
-
Save andy318/960125 to your computer and use it in GitHub Desktop.
Create a deck of cards and return 13 of them at random
This file contains 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
cards = [*'2'..'10', 'J', 'Q', 'K', 'A'] | |
suits = ['C', 'D', 'H', 'S'] | |
deck = cards.product(suits).map(&:join) | |
hand = deck.shuffle.each_slice(13).first |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment