- substr: documentation ( source)
- hash: documentation ( source)
- hexdec: documentation ( source)
<?php
$server_seed = "71c18a0dbfb07f28bd36e643ef8bab8b3f17e3231db7eb16bc767e7bff9ff326";
$public_seed = "9316595";
$round = "9316600";
$hash = hash('sha256', $server_seed . "-" . $public_seed . "-" . $round);
$roll = hexdec(substr($hash, 0, 8)) % 15;
if ($roll == 0) $roll_colour = 'bonus';
elseif ($roll >= 1 and $roll <= 7) $roll_colour = 'T';
elseif ($roll >= 8 and $roll <= 14) $roll_colour = 'CT';
echo("Roll: $roll\nColour: $roll_colour");