Provably fair implementation

Neodice is a provably fair casino, that is why we provide our RNG algorithm and a detailed description of it work. Rest assured of our fairness!


Random Number Generator

You can check and calculate the betting results with our algorithm or try any other independent software.

$luckyNumber = (static function(
    string $serverSeed,
    string $clientSeed,
    int $nonce
): float {
    $hash = hash_hmac('sha512', "${clientSeed}-${nonce}", $serverSeed);
    $offset = 0;
    do {
        $number = hexdec(mb_substr($hash, $offset, 5));
        $offset += 5;
    }
    while($number >= 1000000);

    return ($number % 10000) / 100;
});

echo $luckyNumber($serverSeed, $clientSeed, $nonce);
const luckyNumber = (({
    serverSeed,
    clientSeed,
    nonce
}) => {
    const hash = sha512.hmac(serverSeed, `${clientSeed}-${nonce}`);
    let offset = 0, number = 0;
    do {
        number = parseInt(hash.substr(offset, 5), 16);
        offset += 5;
    }
    while (number >= 1000000);

    return (number % 10000) / 100;
});

alert(luckyNumber({serverSeed, clientSeed, nonce}));

How it works

In order to generate a roll of the dice, we combine your {Client seed} and {Nonce} into a string with a dash. Then, the SHA512.HMAC function is used to hash this string using the {Server seed}. This gives us a 128 character hex string.

Then, we take the first 5 characters of this hexadecimal string and convert them into a decimal integer (which will range from 0 to 1048575 (16 ^ 5-1)). If it's less than 1 million, we divide it by 10,000 and use it to roll the dice. This happens in 96% of cases. Otherwise, we use the next five characters of a 128 character hex string and repeat.

In the unlikely event that none of the 25 groups of five characters is less than 1 million when converted to decimal, we use the remaining 3 hexadecimal digits, which give a number in the range 0 to 4095, which is equivalent to a roll of a dice 0.00 through 40.95.


You can also use our online verifier to check any bet. Or use any other similar software.