- lcg_value: documentation ( source)
- var_dump: documentation ( source)
- floor: documentation ( source)
- pow: documentation ( source)
<?php
function weightedRand($min, $max, $gamma) {
$offset = $max - $min + 1;
return floor($min + pow(lcg_value(), $gamma) * $offset);
}
$ola = weightedRand(1, 4, 2.2);
var_dump($ola);