Connect via MCP →

Enter Calculation

Suits in deck
Ranks in deck

Formula

Formula: Random Playing Card Generator
Show calculation steps (1)
  1. Fisher-Yates shuffle (without replacement)

    Fisher-Yates shuffle (without replacement): Random Playing Card Generator

    For k from N-1 down to 1, choose j uniformly and swap, producing an unbiased random permutation; take the first numSamples cards.

Advertisement

Results

Cards Drawn
2
from a deck of 52 cards
Three of Hearts
Seven of Clubs
Deck size 52 cards
Drawn cards Three of Hearts, Seven of Clubs

What this tool does

The Random Playing Card Generator deals one or more cards from a virtual, freshly shuffled deck of standard playing cards. You decide how many cards to draw, whether the deck is customized, and whether each drawn card is put back (with replacement) or set aside (without replacement). It is handy for card games, classroom probability lessons, magic tricks, decision-making, and anywhere you need a fair, unbiased random card.

Standard 52-card deck arranged by suit and rank with two jokers
A standard deck: 13 ranks across four suits, plus optional jokers.

How to use it

Enter how many cards to draw, choose a draw mode, and set how many cards to display per row. Under Deck Settings you can toggle individual suits (Clubs, Diamonds, Hearts, Spades) and ranks (2 through Ace), and add 0, 1, or 2 jokers. The effective deck is every rank-and-suit pair where both boxes are checked, plus any jokers. By default the deck is the full 52 cards.

The formula explained

The deck is a list of \(N\) cards. To draw one card we compute a uniform random index $$i = \lfloor \text{random()} \times N \rfloor$$ where random() returns a real number in [0, 1). In "Reused" mode each draw is independent from the full deck, so the same card can appear more than once. In "Removed" mode we run a Fisher-Yates shuffle - for \(k\) from \(N-1\) down to 1 we pick $$j = \lfloor \text{random()} \times (k+1) \rfloor,\quad D[k] \leftrightarrow D[j]$$ and swap positions \(k\) and \(j\) - then take the first cards, guaranteeing no duplicates.

Advertisement
Random value between 0 and 1 mapped to an index in a card array
A random fraction times the deck size N selects a card index.

Worked example

Using the default 52-card deck, drawing 2 cards in "Reused" mode: suppose random() returns 0.0769 then 0.6442. Card 1 index $$= \lfloor 0.0769 \times 52 \rfloor = 3$$ card 2 index $$= \lfloor 0.6442 \times 52 \rfloor = 33$$ The result is an ordered pair of cards such as "Five of Clubs" and "Nine of Spades", shown two cards wide.

FAQ

What is the difference between Reused and Removed? Reused draws with replacement (duplicates possible); Removed draws without replacement (every card is distinct, like dealing a hand).

Can I draw more cards than the deck holds? Only in Reused mode. In Removed mode the count is capped at the deck size, because you cannot deal more distinct cards than exist.

How are jokers handled? Jokers have no suit and are simply named "Joker". With two jokers in Removed mode they count as two distinct draws even though they share a name.

Last updated: