Пример #1
0
 private static function randRange(Random $rng, $lower, $upper)
 {
     if ($lower > $upper) {
         throw new \InvalidArgumentException();
     }
     $factor = $rng->nextDouble();
     return (int) floor($lower + ($factor * (1.0 + $upper) - $factor * $lower));
 }