Card Deck in Ruby
In this guide you will learn how to create a deck of cards using a custom seed and random algorithm.
Guide Tasks
- Read Tutorial
- Complete the Exercise
Summary
Build a class that can create and shuffle a deck of cards using a custom seed and a random algorithm.
Exercise Description
Define a class that can create a deck of cards that you can shuffle with a custom seed and random algorithm.
Example Data
'cd = CardDeck.new.deck' -> expect(cd.last).to eq('Ace of diamonds') 'cd = CardDeck.new' -> expect { cd.seed = 1 }.to_not raise_error 'cd.seed = 1' -> expect(cd.shuffle_deck[42]).to eq('5 of hearts')
Real World Usage
This exercise will help you learn how to make custom seeds in algorithms.