News for hackers. Stuff that matters.
Re:The Time Everyone “Corrected” the World’s Smartest Woman ... by hypertele-Xii on Saturday May 08, 2021 @11:48PM (#27093062)
I also wrote a simulation, in PHP, when I first encountered this problem.

  <?php
  $wins = 0;
  for ($i = 0; $i < 1000; $i ++)
   {
   $car = mt_rand(0, 2);
   $choose = mt_rand(0, 2);
   if ($choose == $car) $wins ++;
   }
  echo "stay: " . ($wins / 1000 * 100) . "%<br />";
  // switch
  $wins = 0;
  for ($i = 0; $i < 1000; $i ++)
   {
   $car = mt_rand(0, 2);
   $choose = mt_rand(0, 2);
   if ($choose != $car) $wins ++;
   }
  echo "switch: " . ($wins / 1000 * 100) . "%";

There are no comments on this comment yet.