- var_dump: documentation ( source)
- arsort: documentation ( source)
- rand: documentation ( source)
<?php
$a = 0;
$attackCount = 1000000;
for($i = 0; $i < $attackCount; $i++)
{
$a1 = [rand(1,6), rand(1,6)];
arsort($a1);
$b1 = [rand(1,6), rand(1,6)];
arsort($b1);
$a += $a1[0] > $b1[0];
$a += $a1[1] > $b1[1];
}
var_dump($a / $attackCount);