The art of generating random data

When it comes to playing a game involving even the smallest extent of luck, the task of generating random data is crucial. A biased algorithm may not only kill the excitement of players, but cost them their own stake.

Random number generators determine the result of such games. In the gambling sphere, the importance of their fairness is unquestionable.

Hosts should aim to provide their players a transparent, unbiased and auditable random number generator.

  • Transparency can be achieved by publishing the algorithm used for generating random data. In order to prevent malicious behavior, algorithmic determinism is necessary. Black box functions (including true random generators) violate these constraints, so they are ineligible for this purpose.
  • Bias can be avoided by using random seeds to initialize a so-called pseudorandom number generator (PRNG). Contrary to a true random number generator, PRNGs solely depend on the seed given to them.
  • Data generated by PRNGs are verifiable by nature given the seed and the PRNG function itself. Verifiers only need to compute the PRNG’s outputs and compare them with the host-computed results.

Seeding a game

Seed generation shall be distributed amongst players and hosts.

To avoid bias, no entity may know the seed of others during this process.

In most applications, seeds consist of two main parts:

  • Host seed: Chosen at first and kept in secret until the end of a particular game.
  • Public seed: Chosen by every player of a game. Multiple players may contribute to it by using a commitment scheme. Should be revealed after a commitment to the host seed has been made.

(If multiple players bet against each other, then every participant should also be a host. The aforementioned situation describes the problem of playing a mental poker game.)

Host seeds should be computationally infeasible to break. This can be achieved by making them large and using a reliable source of entropy for their generation (e.g. a true random number generator device). Besides that, using a long period PRNG is recommended.

Multiple betting rounds

Having to choose a new seed before each betting round is inconvenient. A predictable value called a nonce can transform a single public seed to an arbitrarily large set of seeds. A unique nonce should be appended to the public seed before each round.