Provably Fair

Check any round you played. The maths runs on your own device, so you are checking the bot rather than taking its word for it.

How it works

  1. Before you play, the bot picks a secret server seed and shows you only the SHA256 hash of it. Run /fair in Discord to see yours.
  2. You pick a client seed. It is yours, it is public, and you can change it whenever you like with the Change client seed button in /fair.
  3. Every round you play gets its own nonce, counting up from 0. Round one is nonce 0, round two is nonce 1, and so on. The result is computed from those three values and nothing else.
  4. When you hit Rotate and reveal in /fair, that server seed is retired and shown to you in full, and a fresh one takes over. Every round you played on the retired seed can then be recomputed here.

The seed cannot be swapped after the fact, because the hash you were shown up front would no longer match it. That is the whole guarantee: the result existed before your bet did.

Verify a round

This is the seed itself, printed by Rotate and reveal in /fair - not a hash. A hash is one-way and can't be turned back into the seed, so pasting one here will just produce the wrong answer.

SHA256 of the seed appears here.

The algorithm, in full

Written out so anyone can reimplement it and get the same answers. The code on this page is the whole implementation, so view source if you would rather read that.

Bytes. Block c of a round is HMAC_SHA256(key = server seed, message = "clientSeed:nonce:c"), with the server seed used as its 64 hex characters of ASCII, not as decoded bytes. Blocks run c = 0, 1, 2 and so on, and bytes are consumed left to right.

A number below n. Read four bytes as a big endian unsigned 32 bit integer. If it is below 2^32 - (2^32 mod n), the draw is that value mod n. Otherwise throw it away and read the next four bytes. Discarding rather than folding is what keeps every outcome exactly equally likely, with no small edge on the low numbers.

Roulette. One draw below 38. Pocket 37 is the double zero.

Slots. One draw below the reel length per symbol. Classic and Mini draw three, left to right. High Roller draws nine, row by row and left to right. Cascade draws below 100 per cell and maps it onto the weight bands, five per row for three rows, then keeps drawing from the same stream for every refill.

Mines. A partial Fisher Yates over the 20 tiles: for i from 0 up to the mine count, swap position i with position i plus a draw below 20 minus i, then take the first mine count entries. Tiles are numbered 0 to 19 here and 1 to 20 on the board.

Dice poker. Ten draws below 6, plus one each. The first five are the bot's hand, the next five are yours.

Blackjack. Six decks are laid out in order: for each deck, values 2 to 14 of diamonds, then hearts, then spades, then clubs, where 11 to 14 are jack, queen, king, ace. That 312 card list is shuffled with a full Fisher Yates pass running from the last index down to 1, each step swapping index i with a draw below i plus 1. The shuffled list is then reversed, and cards are dealt from the front of the reversed list: your first card, the dealer's first, your second, the dealer's second.