0% found this document useful (0 votes)
327 views

9999 Script

This document contains PHP code that simulates running a lottery game 100,000 times to calculate the expected number of wins in different prize tiers. It initializes variables to track the counts of jackpot wins, 10k prize wins, and wins in various number ranges. It then runs a loop 100,000 times, generating random numbers, checking the ranges, and incrementing the count variables. After the loop, it displays the final count values.

Uploaded by

R. V. Banna
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
327 views

9999 Script

This document contains PHP code that simulates running a lottery game 100,000 times to calculate the expected number of wins in different prize tiers. It initializes variables to track the counts of jackpot wins, 10k prize wins, and wins in various number ranges. It then runs a loop 100,000 times, generating random numbers, checking the ranges, and incrementing the count variables. After the loop, it displays the final count values.

Uploaded by

R. V. Banna
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

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