- substr: documentation ( source)
- abs: documentation ( source)
- uniqid: documentation ( source)
- hash: documentation ( source)
- hexdec: documentation ( source)
- rand: documentation ( source)
- md5: documentation ( source)
<?php
$salt = "fe5e5c41b";
$roll_id = 2;
for($i = 0; $i < 1000; $i++) {
echo generateRandomNumber(md5(uniqid(rand(), true)), $salt, 0) . "\r\n";
}
function generateRandomNumber(string $seed, string $salt, int $roll): int
{
$roll_hash = hash("sha256", $seed . "-" . $salt . "-" . $roll);
$roll_hash_first16 = substr($roll_hash, 0, 16);
return abs(hexdec($roll_hash_first16) % 37);
}
This script was stopped while abusing our resources