D DeckLab.
Math Utilities

4 underlying math tools behind every deck tool

Every TCG tool is, in the end, hypergeometric math plus a shuffle plus a counting. Here are those pieces as standalone utilities — useful when you're debugging a deck, checking a claim in a forum post, or testing a new TCG idea.

Hypergeometric Probability Lab

The general "draw N from population K with M successes" calculator. We also tell you when your "sample size" assumption makes the math dubious: hypergeometric converges to binomial when N ≪ K, and the tool flags that case so you know you can swap to a simpler formula.

Cryptographic Shuffler

Standard Fisher-Yates, but with crypto.getRandomValues() instead of Math.random(). Most "shuffle online" tools use the latter — which is biased and predictable. We also give you a seed you can save: paste it back later to reproduce an exact shuffle.

Combination Counter

nCr / nPr, with a clear breakdown of what the numbers mean for card games. The "Texas Hold'em hole-card combos" preset is a useful sanity check: 52 cards taken 2 at a time = 1,326 distinct starting hands, of which 312 are suited, 936 are unsuited, and 78 are pocket pairs.

Random Hand Generator

Draws a fair hand from 1–10 standard decks. Useful for practice, sorting games, magic tricks, and as a quick source of "test" cards for other tools. Optional filters by suit or rank let you isolate special cases.

How to use the four math utilities: the manual behind every other tool

These four calculators are the bricks the rest of the lab is built from: every draw-probability question on the site reduces to a hypergeometric calculation, every fair deal needs a shuffle, and every claim about "how many ways" needs a counting rule. Using them well means translating a card question into four parameters before you touch any box. This usage guide walks through each utility step-by-step, shows how the parameters map to a real card situation, and lists the common mistakes that quietly produce a plausible but wrong number. It also spells out the limits of the page, including where an exact enumeration is a better answer than a formula.

① Hypergeometric Probability Lab — mapping a card question

  • Translate the question into four values: population K is the size of the deck, successes M is the number of copies of the card you care about, sample N is the number of cards you will actually see, and the minimum successes x is how many copies you need.
  • For example, a four-of in a sixty-card deck with a seven-card opening hand is K equal to 60, M equal to 4, N equal to 7 and x equal to 1, and the tool returns the probability of seeing at least one copy.
  • The tool also flags the regime you are in: a sample that is tiny relative to the population behaves almost like a binomial draw, while a sample that is more than half the population makes the result sensitive to the exact composition.
  • Watch out for the input guard: M and N must both be smaller than or equal to K, and a minimum-success target above M returns zero, which is a correct answer but often a sign that you swapped two parameters.

② Cryptographic Shuffler — seeds, replay and what the output means

  • Set the number of cards, leave the seed blank for a fresh random shuffle, and press shuffle; the tool runs a Fisher-Yates pass driven by crypto.getRandomValues rather than the biased built-in generator.
  • The printed order is a permutation of position numbers, not card names, so map position one to your first card yourself if you want to talk about the deal in card terms.
  • The seed shown after a run is the seed for the next shuffle: to reproduce a specific order, paste that seed into the seed box and shuffle again, and the same permutation comes back.
  • Two limits are worth knowing: seeded replay is reliable for up to sixty-four cards, since the seeded generator produces a fixed-length block of random values, and the modulo reduction in the shuffle carries a very small theoretical bias that is negligible for practice but not formally zero.

③ Combination Counter — counts that survive a second look

  • Enter n items and r selections to get combinations, where order does not matter, and permutations, where order does.
  • The Hold'em preset shows why the distinction matters: a single deck gives one thousand three hundred and twenty-six unordered two-card starting hands, split into suited, unsuited and pocket-pair classes, and each class has a different number of underlying suit combinations.
  • The same rule scales to shoe games: with two decks in play the population doubles, so the two-card count doubles as well, and any count you quote must name the deck count it assumed.
  • Key caution: the preset button overwrites both input boxes with the poker values, and very large inputs can reach the limits of floating-point arithmetic, so cross-check a surprising figure with a second method.

④ Random Hand Generator — reading the filters correctly

  • Choose the number of decks, the number of cards, and an optional filter, then draw; the generator shuffles the pool with a cryptographic pass and prints the hand as rank and suit pairs.
  • Filters change the pool before the draw rather than filtering the result, so a hearts-only draw is genuinely a draw from hearts alone, which is useful for practice hands and for isolating special cases.
  • Two quirks are easy to get wrong: the numbers-only filter excludes tens along with the face cards, so it produces ranks two through nine, and there is no filter for diamonds or clubs.
  • With several decks in play, duplicate rank-and-suit pairs are legitimate rather than a bug, and asking for more cards than the filtered pool holds simply returns everything the pool contains.
Three common mistakes: ① mapping the card question into the wrong boxes — the most common version puts the deck size in the sample field, and the result still looks like a plausible percentage; ② assuming the seed printed by the shuffler reproduces the order you just looked at, when it is in fact the seed for the following shuffle; ③ quoting a combination count without stating whether order matters and how many decks were assumed, since a count of unordered two-card pairs in one deck and the same count in a two-deck shoe are different numbers.
How do I use these four utilities step-by-step?

Write the card question in words first, then assign the four hypergeometric parameters, compute, and note the regime warning if one appears. If the question is about fairness or a claim made in a forum thread, shuffle with a saved seed, reproduce the order twice, and confirm the permutation is identical. If the question is about counting, decide explicitly whether order matters before you compute, and state the deck count. If the question is about a drill, use the hand generator with a filter to produce a narrow pool of cards on purpose.

Why does the hypergeometric lab warn me about sample size?

Because the approximation changes shape depending on how much of the population you take. When the sample is a very small fraction of the population, the draws behave almost independently and a simpler binomial formula gives nearly the same answer, which is why the tool flags that case as an approximation-friendly regime. When the sample is larger than half the population, the result becomes highly sensitive to exactly which cards are missing, and only exact enumeration is trustworthy. Neither warning means the number is wrong; both mean you should know which formula you are standing on.

What are the common mistakes with the shuffler and the combination counter?

With the shuffler, people expect the displayed seed to replay the order they just saw, but the seed is generated after the shuffle and belongs to the next one, so paste it in and shuffle again to reproduce. People also read the output as card identities when it is a list of positions. With the counter, people forget that combinations and permutations answer different questions, and they forget that the preset button resets their inputs. A fourth habit worth building: cross-check one figure with a second method before you publish it.

What are the limits of these tools, and what is this not for?

They are building blocks, not a rules engine. The probability lab assumes sampling without replacement from a fixed population, so it does not model reshuffles, sideboarding or mulligans that change the population. The shuffler demonstrates an unbiased-alike algorithm and a reproducible seed; it does not certify the shuffle procedure of any physical game, and it is not an audit service. The combination counter is arithmetic, not gameplay. None of this replaces the official rules, and card lists, product contents, prices and legality differ by product and by region, so verify anything product-specific with the official publisher or regulator.

Scope and limits: all four utilities run locally in your browser with no upload, no account and no stored history. The results are mathematical and reproducible from the inputs you give, but they inherit every assumption listed above and the usual limits of floating-point arithmetic at extreme sizes. Treat the outputs as reference values for learning and cross-checking, and confirm game-specific rules, card data and any product or pricing questions with the official publisher, rules body or regulator for your region before you rely on them.

Why we expose the math

Hypergeometric is the workhorse of every TCG

If you've ever wondered "is a 4-of in a 60-card deck the same as a 3-of in a 40-card deck?" — the answer is no, the difference is roughly 12% vs. 15% in opening-5. Use this lab to check.

Math.random() is not fair enough

It's a 32-bit PRNG with predictable period. For a real shuffle of a real deck, we use crypto.getRandomValues — and we still let you reproduce a deal with a seed.

1326 — yes, that number is correct

C(52,2) = 1,326 unique Hold'em starting hands. Each unsuited hand has 6 combos (4 × 3 / 2), each pocket pair has 6 combos (C(4,2)), and each suited non-pair has 4 combos. Add up: 312 suited + 936 unsuited + 78 pairs = 1,326.

Why "1-10 decks" only?

Past 10 decks the wall-clock time of drawing gets noticeable. Real games rarely need more than that.

Sponsored editorial slot.