fork download
  1. <?php
  2.  
  3. // your code goes here
  4. $hits = 0;
  5. for($i = 1; $i <= 100000; $i++){
  6. $chance = mt_rand(1,100);
  7.  
  8. if($chance <= 4){
  9. $hits++;
  10. }
  11. }
  12.  
  13. echo ($hits / 100000)*100 . "%";
Success #stdin #stdout 0.03s 26392KB
stdin
Standard input is empty
stdout
4.056%