- substr: documentation ( source)
- sha1: documentation ( source)
- hexdec: documentation ( source)
<?php
$serverSeed = '7db5eef616a2c672630953954757df8400eeed22a3e0fc1ac6c5555200e122b91e6825b8faf19c723cb09de3da434970a157c21c31b6986e4a75b777361168bc';
$clientSeed = 'FFFFE380';
$nonce = 1;
for($nonce =1; $nonce <= 20; $nonce++){
$seed = $serverSeed.'-'.$clientSeed.'-'.$nonce;
do {
$seed = sha1($seed);
$lucky = hexdec(substr($seed,0,8));
} while ($lucky > 4294960000);
$luckyNumber = ($lucky % 10000) / 100;
if ($luckyNumber < 0)
$luckyNumber = -$luckyNumber;
echo $nonce.":".$luckyNumber;
echo ("\n");
}
?>