HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

random_int

Description

The random_int of Random for PHP get a cryptographically secure, uniformly selected integer.

Syntax

random_int(
    int $min,
    int $max
): int

Parameters

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 · return

<?

$min = -1;
$max = 1;

$return = random_int($min, $max);

echo $return;
0

2 · PHP_INT_*

<?

$min = PHP_INT_MIN;
$max = PHP_INT_MAX;

$return = random_int($min, $max);

echo $return;
-1718773488625426419