Who draws
Cards, dice, Word Tiles letters and tiles are drawn by the OMGLoft server, not by your browser. Nobody — neither the players nor the site staff — chooses who gets what.
Where the numbers come from
The server asks the operating system for random bytes from its cryptographic generator. It is the same kind of generator used to create passwords and encryption keys. Such numbers cannot be predicted, neither in advance nor from the previous ones.
Every value has the same chance
From 32 random bits (a number from 0 to 4,294,967,295) we need a number from a smaller range, for example one of 52 cards. A plain remainder of division would favour some values, because 4,294,967,296 does not divide evenly by 52. So we throw the excess away and draw again. This is the whole function:
defp uniform(n) do
limit = div(0x1_0000_0000, n) * n
<<value::32>> = :crypto.strong_rand_bytes(4)
if value < limit, do: rem(value, n), else: uniform(n)
endlimitis the largest multiple ofnthat fits in 32 bits. Numbers fromlimitupwards are the excess.:crypto.strong_rand_bytes(4)returns 4 random bytes from the system generator, read as the numbervalue.- When
valueis belowlimit, the result is the remainder of dividing byn— so each of thenvalues comes up exactly equally often. - Otherwise we draw again. With 52 cards that happens roughly once in 90 million draws.
Shuffling and rolls
- The deck is shuffled with the Fisher–Yates method: from the last card to the first, each one is swapped with a card drawn by this function from those not yet shuffled. This makes every order of the deck equally likely.
- Dice are simply numbers from 1 to 6 from the same function, each roll separately.
- The letter bag and tiles are shuffled the same way as the deck.
What this means, and what it doesn't
The drawn values are written to the match log, so a replay shows exactly what happened. This page explains how we draw — it does not give you a way to verify a particular match yourself. If something in a game looks suspicious to you, write to us: Write to us through the contact form..
