0% found this document useful (0 votes)
623 views2 pages

Working 9999 Roll Script But Needs Work

This document defines functions and variables for rolling random numbers between 0 and 10000 over multiple iterations. It: 1) Defines variables like $fast, $tries, and $c to control the number of rolls and printing output. 2) Generates random client and server seeds and hashes them to produce a random number result for each iteration. 3) Checks the random number result and assigns it a color code, with special handling for results 9999 or 10000. 4) Defines additional functions for generating random numbers, strings, and performing the rolls in a loop up to the number of tries.

Uploaded by

Andy Mac
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
623 views2 pages

Working 9999 Roll Script But Needs Work

This document defines functions and variables for rolling random numbers between 0 and 10000 over multiple iterations. It: 1) Defines variables like $fast, $tries, and $c to control the number of rolls and printing output. 2) Generates random client and server seeds and hashes them to produce a random number result for each iteration. 3) Checks the random number result and assigns it a color code, with special handling for results 9999 or 10000. 4) Defines additional functions for generating random numbers, strings, and performing the rolls in a loop up to the number of tries.

Uploaded by

Andy Mac
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

$fast = 0; // 1 = only print if 9999 or 10000 hits, 0 = prints a wall of numbers

rolled
$tries = 10000; // will work at 20000 if $fast is set to 1, the wall can time out

$c=1;// Iteration count


do {
$nonce = $c;
$s_seed = server_string(); // 12 char server seed string
$c_seed = client_string(); // 16 char client seed string
$rnd = 429496.7295; // number provided to round by

$nhash = hash_hmac('sha512',"$nonce:$s_seed:$nonce","$nonce:$c_seed:
$nonce",false); // hash server and client seeds
$result = hexdec(mb_substr($nhash, 0, 8 ))/$rnd; // get first 8 chars and hex to
dec
$result = ceil($result);

if ($fast == 0) {
switch (true) {
case ($result == 10000) : $txtcol = '#DBA901'; break;
case is_between($result, 0, 9885) : $txtcol = '#58D3F7'; break;
case is_between($result, 9886, 9985) : $txtcol = '#0000FF'; break;
case is_between($result, 9986, 9993) : $txtcol = '#DF01D7'; break;
case is_between($result, 9994, 9997) : $txtcol = '#000000'; break;
case is_between($result, 9998, 9999) : $txtcol = '#FE2E2E'; break;
}
while ($c <= $tries);

function is_between($in, $min, $max) {


return ($in >= $min && $in <= $max);
}
function make_rand($l,$h) {
mt_srand(make_seed());
return mt_rand($l,$h);
}
function make_seed() {
list($usec,$sec) = explode(' ', microtime());
}
//convert from javascript example posted in forum
function client_string () {
$charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$strlen = strlen($charSet);
$ranStr = null;

for ($i = 0; $i < 16; $i++)


{
mt_srand(make_seed());
$ranStr = substr($charSet, mt_rand(0, strlen($charSet)), 1);
}
return implode($ranStr,'');
}
function server_string () {
$charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$strlen = strlen($charSet);
$ranStr = null;

for ($i = 0; $i < 12; $i++)


{
mt_srand(make_seed());
$ranStr = substr($charSet, mt_rand(0, strlen($charSet)), 1);
}
return implode($ranStr,'');
}};startgame()

You might also like