50% found this document useful (2 votes)
1K views1 page

999 Roll

This PHP script simulates 100,000 lottery number draws and counts the results. It uses hashes and random number generation to simulate lottery numbers between 0-9999. The script outputs the counts of numbers that match certain prize tiers out of the 100,000 draws. Functions are used to generate random seeds, strings, and numbers within a range.

Uploaded by

kyu
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
50% found this document useful (2 votes)
1K views1 page

999 Roll

This PHP script simulates 100,000 lottery number draws and counts the results. It uses hashes and random number generation to simulate lottery numbers between 0-9999. The script outputs the counts of numbers that match certain prize tiers out of the 100,000 draws. Functions are used to generate random seeds, strings, and numbers within a range.

Uploaded by

kyu
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/ 1

<?

phpset_time_limit(360); // number of seconds to run script, default is


30$_jackpot = $_10k_pz = $_prize1 = $_prize2 = $_prize3 = $_prize4 = $_prize5 =
0;$tries = 100000; //Number of tires$c=1;// Iteration countdo {// nonce = $c;// 12
char server seed string, 16 char client seed string$nhash = hash_hmac('sha512',
$c.':'.seed_string(12).':'.$c,$c.':'.seed_string(16).':'.$c,false);$_no =
ceil(hexdec(mb_substr($nhash, 0, 8 ))/429496.7295);$_jackpot += ($_no == 8888);
$_10k_pz += ($_no == 10000);$_prize1 += ($_no >= 0 && $_no <= 9885);$_prize2 +=
($_no >= 9886 && $_no <= 9985);$_prize3 += ($_no >= 9986 && $_no <= 9993);$_prize4
+= ($_no >= 9994 && $_no <= 9997);$_prize5 += ($_no >= 9998 && $_no <= 9999);$c++;}
while ($c <= $tries);echo '<pre>[Counts out of ', $tries, ' tries]Jackpots: ',
$_jackpot, '10000 prize: ', $_10k_pz, '0000-9885: ', $_prize1, '9886-9985: ',
$_prize2, '9986-9993: ', $_prize3, '9994-9997: ', $_prize4, '9998-9999: ',
$_prize5, '</pre>';function make_rand($l,$h) {mt_srand(make_seed());return
mt_rand($l,$h);}function make_seed() {list($usec,$sec) = explode(' ',
microtime());return (float) $sec + ((float) $usec * 65536);}function seed_string
($itr) {$charSet =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';$ranStr = null;for
($i = 0; $i < $itr; $i++) {mt_srand(make_seed());$ranStr[] = substr($charSet,
mt_rand(0, strlen($charSet)), 1);}return implode($ranStr,'');}?>

You might also like