random_int
Description
The random_int of Random for PHP get a cryptographically secure, uniformly selected integer.
Syntax
random_int(
int $min,
int $max
): intParameters
min
The lowest value to be returned.
max
The highest value to be returned.
Return
A cryptographically secure, uniformly selected integer from the closed interval [min, max]. Both min and max are possible return values.
Examples
1 · min max
<? $min = -10; $max = 10; $return = random_int($min, $max); echo $return;
8
2 · PHP_INT_*
<? $min = PHP_INT_MIN; $max = PHP_INT_MAX; $return = random_int($min, $max); echo $return;
3007303257959435605