Guide
A virtual deck: shuffle, draw and deal with every card used once
A deck of cards is one of the oldest randomisers and one of the most useful: fifty-two different things, each used once. It decides who goes first, deals a hand of poker, picks a student, runs a magic trick or settles an argument. This page is a deck on the screen. It is shuffled properly, never loses a card and keeps count of what is left.
The deck
The deck is a standard French-suited deck of 52 cards: thirteen ranks from ace to king in each of four suits, spades, hearts, diamonds and clubs. Hearts and diamonds are shown in red. You can add two jokers with the switch at the top. When you change it, the page shuffles a new deck. Each card has an aria label with its full name, such as Queen of Hearts, for screen readers, and shows its rank and suit symbol.
The shuffle
The deck is shuffled with the Fisher-Yates method: going from the last card to the first, each card swaps with one chosen at random from the cards up to and including it. If the random numbers are good, every one of the 52 factorial possible orders is equally likely. The page uses the browser’s cryptographic random generator, which is designed to be unpredictable, rather than a simple pseudo-random function. Press Shuffle a new deck at any time to put all cards back and shuffle.
Drawing
Draw 1 card takes the top card of the deck and shows it. Draw a larger number with the box and its button, from 1 to 54. The cards you draw are removed from the deck, so the next draw cannot repeat them. The numbers on top of the page show how many cards are left and how many of each suit, which is useful for counting. If you ask for more cards than are left, the page tells you how many remain and suggests a new deck.
Dealing
Dealing gives hands to players. Choose the number of players, from 1 to 12, and the number of cards each, from 1 to 26, and press Deal. Cards go one at a time round the table, so the first player gets the first, the second the second and so on, exactly like a physical deal. The hands appear one under another, labelled Player 1, Player 2 and so on. If the cards you ask for are more than are left, the page reports how many are left. Copy what was drawn puts the cards or hands on the clipboard as text.
A worked example
Open the page: the deck has 52 cards left, 13 of each suit. Press Draw 1 card, then Draw 5, and the count falls to 46. Press Deal with the default four players and five cards each: four hands of five cards appear, 20 in all, and the count falls to 26. No card appears twice among the 26 cards on the screen. Press Shuffle a new deck and the count returns to 52.
Ideas
Use a deck to pick a random student: give each pupil a rank and suit. Deal five cards each for poker, or seven for rummy, and keep the rest as the stock by not drawing them. Make an instant random order: deal one card to each person and rank by the card. For a yes-or-no choice, let red mean yes and black mean no. Count down a hand with a game of high card.
Limits
The page does not play any card game, score hands or enforce rules, and does not support several decks mixed together. Nothing is stored between sessions, and nothing is sent anywhere.
Related tools
Dice Roller rolls dice. RPG Dice Roller handles dice notation. Flip a Coin makes a two-way choice, and Random Number Generator picks numbers.
Checked against the current version of the Card Deck Shuffler & Dealer on .

