Random\Randomizer::getInt
Get a uniformly selected integer
Description
public int Random\Randomizer::getInt(int $min
, int $max
)
Parameters
-
min
-
The lowest value to be returned.
-
max
-
The highest value to be returned.
Return Values
A uniformly selected integer from the closed interval
[min
, max
]. Both
min
and max
are
possible return values.
Errors/Exceptions
-
If
max
is less than min
, a
ValueError will be thrown.
-
Any Throwables thrown by the Random\Engine::generate method
of the underlying
Random\Randomizer::$engine
.
Examples
Example #1 Random\Randomizer::getInt example
<?php
$r = new \Random\Randomizer();
// Random integer in range:
echo $r->getInt(1, 100), "\n";
?>
The above example will output
something similar to:
See Also
- random_int
- Random\Randomizer::getFloat