Generates cryptographically secure pseudo-random integers
Syntax
random_int ( int $min , int $max ) : int
Parameters
min
The lowest value to be returned, which must be PHP_INT_MIN or higher.
max
The highest value to be returned, which must be less than or equal to PHP_INT_MAX.
Return
Returns a cryptographically secure random integer in the range min to max, inclusive.
Examples
1
<? $min = 0; $max = 10; $return = random_int($min, $max); echo $return; ?>
3
2
<? $min = PHP_INT_MIN; $max = PHP_INT_MAX; $return = random_int($min, $max); echo $return; ?>
5515960729736908919