President Contents Play free →

The Provably Fair Shuffle

The first thing people suspect about any online card game is the deal: that the server, or its bots, get better cards. President is built so you don't have to take our word for it. After every hand you can check, in your own browser, that the shuffle was fixed before anyone saw a card and that the hand you were dealt came from that shuffle.

What provably fair means here

It doesn't mean trusting our code or an outside audit. It means the server commits to the shuffle before the deal and reveals how it was made afterwards, so anyone can redo the shuffle and see that it matches.

The commitment is a SHA-256 hash of a random seed. A hash only works one way: seeing it tells you nothing about the seed, but once it is published the server can't switch to a different seed without the hash changing, and every player already holds the hash.

How a hand is dealt

  1. A fresh seed. For each hand the server draws 32 random bytes from the operating system's secure random source.
  2. Commit. It publishes SHA-256(seed) to everyone at the table. This goes out before any cards do.
  3. Shuffle from the seed. The seed drives a stream of bytes: block number c is SHA-256(seed || c), for c = 0, 1, 2 and so on. Those bytes feed an unbiased number generator, which runs a standard Fisher-Yates shuffle.
  4. A published starting order. The unshuffled deck is always in the same public order: deck 1 then deck 2; within a deck, clubs, diamonds, hearts, spades; within a suit, 3 up to Ace and then 2; that deck's jokers last. The same seed therefore gives the same shuffle on any machine.
  5. Deal. Cards go out one at a time around the table, starting with the player to the dealer's left, until the deck runs out.
  6. Reveal. When the hand ends, the server reveals the seed.

Who deals

In the first hand of a match the dealer is picked from the same committed seed, through a separate stream (SHA-256(seed || "dealer")), so it can't be chosen after the fact and it doesn't use up any of the bytes the shuffle uses. In every later hand the Peasant deals.

How to check it yourself

Open the Fair chip at the top of the table, or Verify the shuffle after a hand. The check runs entirely in your browser, in a short, readable script (/verify.js) that makes no calls to the server. For each finished hand it confirms three things:

What this proves and what it doesn't

It proves the shuffle was decided before the hand began and wasn't changed afterwards, and that your cards came from it.

It doesn't prove the seed was random; no scheme with a single server can. What it removes is the ability to adjust a deal once play has started, or to deal one player from a different deck than the others.

The card exchange between hands is separate from the shuffle. The cards the Peasant gives up are chosen by rule (their best cards), and what you gave and received is shown to you at the table.

Play President free