public static function ParagonIE_Sodium_Compat::randombytes_uniform in Automatic Updates 8
Same name and namespace in other branches
- 7 vendor/paragonie/sodium_compat/src/Compat.php \ParagonIE_Sodium_Compat::randombytes_uniform()
Generate an integer between 0 and $range (non-inclusive).
Parameters
int $range:
Return value
int
Throws
Exception
Error
TypeError
2 calls to ParagonIE_Sodium_Compat::randombytes_uniform()
- php72compat.php in vendor/
paragonie/ sodium_compat/ lib/ php72compat.php - sodium_compat.php in vendor/
paragonie/ sodium_compat/ lib/ sodium_compat.php
File
- vendor/
paragonie/ sodium_compat/ src/ Compat.php, line 3420
Class
Code
public static function randombytes_uniform($range) {
/* Type checks: */
if (!is_int($range)) {
if (is_numeric($range)) {
$range = (int) $range;
}
else {
throw new TypeError('Argument 1 must be an integer, ' . gettype($range) . ' given.');
}
}
if (self::use_fallback('randombytes_uniform')) {
return (int) call_user_func('\\Sodium\\randombytes_uniform', $range);
}
return random_int(0, $range - 1);
}