Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- * Name coinToss
- * @return string
- * @author RapidMod.com
- * @author 813.330.0522
- *
- */
- function coinToss(){
- $counts = array("Heads"=>0,"Tails"=>0);
- $opts = array(1=>"Heads",2=>"Tails");
- $numOpts = random_int(5,12);
- $optCount = 0;
- $odds=array();
- while ($optCount < $numOpts){
- $optCount++;
- $key = random_int(1,2);
- $counts[$opts[$key]]++;
- $odds[$optCount] = $opts[$key];
- }
- $selected = $key;
- $key = random_int(1,$numOpts);
- return $odds[$key];
- }
Advertisement
Add Comment
Please, Sign In to add comment