fork download
  1. #!/usr/bin/perl
  2. $win=0;
  3. $total=100;
  4. $success=55;
  5. for (0..10000)
  6. {
  7. $n=0;
  8. for(0..$total)
  9. {
  10. $n++ if (rand()<0.5)
  11. }
  12. $win++ if ($n>$success)
  13. }
  14. $win /= $total;
  15. print "$win\n";
  16.  
Success #stdin #stdout 0.25s 6044KB
stdin
Standard input is empty
stdout
15.68