- var_dump: documentation ( source)
- mt_getrandmax: documentation ( source)
- rand: documentation ( source)
<?php
$loopCount = 1e6;
$min = 0;
$max = mt_getrandmax()*2;
$res = [
'odd' => 0,
'even'=> 0,
];
while ($loopCount--) {
$v = rand($min, $max);
$v%2 ? $res['odd']++ : $res['even']++;
}
var_dump($res);