The 1–52 range
Fifty-two is a deck of cards, and also a year of weeks, which covers most of what anyone needs the range for.
Map the numbers however suits you. The standard bridge order runs 1–13 clubs, 14–26 diamonds, 27–39 hearts, 40–52 spades, which makes 40 the ace of spades and 52 the king.
One difference from a real deck: this draws with replacement. Tap twice and the same card can appear twice. For a hand of distinct cards, raise the count and the draw runs without repeats.
- 1 to 52, both included
- 52 whole numbers
- 1.92%, exactly 1 in 52
- 1 to 10 numbers per draw
- None inside a multi-number draw
- Every draw gets a link that replays it
What a 1–52 draw is for
- Dealing a single card from a standard 52-card deck
- Picking a week of the year for a plan or a review
- Drawing a card for a workout or party deck
- Choosing one of 52 numbered lots
- Assigning a card to each of 52 participants
How the randomness works
Every tap calls crypto.getRandomValues, the browser's cryptographic generator, and asks it for one unsigned 32-bit value. That lands somewhere between 0 and 4,294,967,295, and it then has to be folded down to the 52 numbers in this range.
Folding it down with a plain remainder is where most generators go wrong, an error known as modulo bias. 52 does not divide 4,294,967,296 evenly: 48 values are left over at the top, and wrapping them around would make the first 48 numbers in the range fractionally likelier than the rest. This tool throws away any raw value at or above the last exact multiple of 52 and draws a fresh one instead. That is rejection sampling. It fires about 1 in 89,478,485 draws, and it is the difference between 1.92% exactly and 1.92% approximately.
Ask for more than one number and the tool keeps drawing until it holds that many distinct values, then sorts them ascending. Nothing is seeded, nothing is sent anywhere, and each draw is independent of the one before it. The roll history under the tool lives in your browser's local storage, where the clear button empties it. The daily lucky numbers elsewhere on this site work the opposite way on purpose: they use a seeded generator so the same date always returns the same set. How random is random sets the two side by side.
Fifty-two cards can be arranged 52 factorial ways, a number with 68 digits in it. Shuffle a deck properly and the order in your hands has, in all likelihood, never existed before and never will again. That is the scale a single 1–52 draw sits inside. For the physical version: seven riffle shuffles are the accepted minimum to lose the previous order, and three or four leave a deck visibly sorted.
- crypto.getRandomValues, the browser's cryptographic generator
- One unsigned 32-bit value, sometimes more
- Rejection sampling onto 52 slots
- 48 of 4,294,967,296 raw values, redrawn
- No. These tools are never seeded
- Your browser. No server ever sees a draw
1–52 — frequently asked
Draw a number and read it against a fixed mapping. Clubs 1–13, diamonds 14–26, hearts 27–39, spades 40–52 is the usual one, with ace low in each block. Write the mapping down before you draw and the result is unarguable.
Seven riffles. Bayer and Diaconis worked out in 1992 that a deck is close to properly mixed after seven, and noticeably ordered before that, which is why casino dealers wash and riffle rather than giving it a quick cut.
Up to ten cards in one draw, with no duplicates. Beyond that you would be running separate draws and tracking what has already come out, which a real deck handles for you by removing the card.