This site works best with JavaScript enabled!

Description: Random Generator - Throw Dice

Random Generator Throw Dice

Here the algorithm of the generator "Throw Dice" is described. With this cryptographically secure random generator you can throw up to 15 dice at the same time. So you do not need to have real dice, but you can simply use the virtual dice on this page.


What is randomness?

Randomness is an event whose state cannot be clearly predicted causally. This means that the result of a random generator may not be predictable or computable. This, however, contradicts the laws of each computer. In other words, a computer can not produce absolutely random numbers without additional peripherals. In this case we call it pseudo-random numbers. In general, you can philosophize about at which point you can actually speak about randomness in practise.

How are "thrown" the dice?

Theoretically, several different methods are used in this generator to generate pseudo-random values. For the actual "dice" answer, a PHP function for cryptographically secure pseudo random numbers is used.

Random generators for binary string

How these random generators work, is explained here in detail.

Random generator for "throwing dice"

The previous random number generators produce relatively good random numbers, which, however, can further be improved. The dice are therefore always generated on server-side with the PHP function random_int(), which generates cryptographically secure pseudo-random numbers:

1
2
3
4
5
6
7
8
9
10
11
12
// Initialization
for ($i = 1; $i <= 6; $i++)
{
   $dice[$i] = 0;
}

// For all dice
for ($i = 1; $i <= $number_dice; $i++)
{
   $number = random_int(1, 6);
   $dice[$number]++;
}
TO THE RANDOM GENERATOR
Share this page
Posted on 12.12.2016 | Last modified on 24.04.2021