Skip to content

The Card Room

A shuffle you can check.

Texas Hold'em, Five Card Draw, Blackjack, Hearts, Spades, Last Card and Go Fish all deal from the same provably fair dealer. Each deck is sealed before the deal and revealed after the hand, so anyone can confirm the cards were not chosen on the fly.

The short answers

Is the poker shuffle fair?

Yes. Every hand starts from a fresh deck shuffled with a cryptographically secure random number generator (crypto.randomInt) and the Fisher-Yates algorithm, which gives every order of the deck the same chance.

How can I check a hand myself?

Before the deal, the TV shows a short fingerprint of the sealed deck (a SHA-256 hash). After the hand, the full deck, the secret salt and the cut are published. Open the Verify a hand page from any phone to recompute the fingerprint and replay every card dealt.

Can the server change the cards mid-hand?

No. The deck order is committed before any card moves, and the table cuts the deck afterward at a point the dealer could not know in advance. Any change would break the published fingerprint.

Can other players or the TV see my cards?

No. Your private cards are written to a database path only your phone can read. The live deck is readable only by the server dealer, and the TV never receives hole cards before showdown.

Is it real-money gambling?

No. All chips are play chips. There is no real money, no prizes and no cash-out.

The technical details

Every Card Room game (Texas Hold'em, Five Card Draw, Blackjack, Last Card, Go Fish, Hearts, Spades) deals from the same dealer core: src/cards/ (client and tests) with a byte-identical copy in functions/src/cards/shared/ (scripts/sync-card-core.mjs copies it, and a drift test fails if the two differ).

How a hand is dealt

  1. Fresh deck every hand. A new ordered deck (52 cards, or a 2-deck shoe in Blackjack) is shuffled with Fisher–Yates using crypto.randomInt (CSPRNG, unbiased integer range, no Math.random, no modulo bias). The server dealer (cardsApi Cloud Function) uses node:crypto; the local preview dealer uses Web Crypto.
  2. Commit. Before any card moves, the dealer publishes commit = SHA-256("v1|" + deck.join(",") + "|" + salt) with a fresh 128-bit random salt. The TV shows the first 8 hex digits as "Deck sealed".
  3. Cut. In a later request, after the commit is public, the table cuts the deck at a position the dealer could not know when it committed (the TV picks it). Like a player cutting a real deck, this means a dishonest server can't pre-arrange the order.
  4. Deal from the top. Cards come off the top of the cut deck in order. Every card's position and recipient (seat, board, burn, house) goes into a deal log.
  5. Reveal. When the hand ends, the dealer publishes the deck, the salt, the cut and the log (the "FairRecord"). Anyone can recompute the hash, check the deck is a real deck (every card exactly once per deck), redo the cut, and replay every dealt card. The /verify page does this in the browser, and every phone gets a "Verify this hand" link.

Private cards are written only to rooms/{code}/cards/{uid} (readable by that player only, per database.rules.json). The live deck is at dealer/{code}, which only the server can read. The TV never gets hole cards; only bots' hands come back to the host.

Statistical results

Tests are in tests/cards-fair.test.ts. The default run uses 1,000,000 shuffles (a few seconds); CARDS_SHUFFLES=10000000 npx vitest run tests/cards-fair.test.ts --silent=false runs the full check.

Run on 2026-11-25 (10,000,000 shuffles):

TestResultPass rule
Card × position chi-square (52×52 table, df 2601)chi² = 2644.8, z = 0.61|z| < 5
Same test on a classic biased shuffle (j drawn from the whole deck)z = 20,749.7, so it's caughtz > 20
Top-card distribution (df 51) and ordered top-pair distribution (df 2651)within |z| < 5|z| < 5
Out-of-range random sourcerejectedthrows
Commit/reveal round trip; tampered deck, salt, cut or logverifies; every tamper failsround trip passes, every tamper fails

z = 0.61 is exactly what a uniform shuffle should look like. The biased-shuffle control shows the same test is sensitive enough to catch the classic implementation bug.

What this does and doesn't claim

  • It shows each hand's deck was fixed before the deal and cut afterward, so cards weren't chosen on the fly, and that the shuffle algorithm is statistically uniform.
  • It isn't a certified RNG audit (e.g. GLI-19 / eCOGRA). A real tournament would want a third-party lab audit of the deployed function plus the published records.
  • Privacy note: revealing the whole deck after a hand means anyone can work out the cards a player folded or mucked. This is standard for provably-fair systems, but if a table wants mucked hands to stay secret, the reveal would need to change (for example, reveal only to the table after the session).
  • In local "Preview dealer" mode (Local Multi-Tab, no server), the TV tab itself holds the deck, so the TV says "Preview dealer (this screen)". Real rooms use the server dealer.
  • Chips are play chips only: no real money, no prizes, no cash-out.