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

gmp_random_range

Description

The gmp_random_range of GMP for PHP gets a uniformly selected integer.

Syntax

gmp_random_range(
    GMP|int|string $min,
    GMP|int|string $max
): GMP

Parameters

min

A GMP number representing the lower bound for the random number

max

A GMP number representing the upper bound for the random number

Return

Returns a GMP object which contains a 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 = gmp_random_range($min, $max);

var_dump($return);

?>
object(GMP)#1 (1) {
  ["num"]=>
  string(2) "-5"
}
HomeMenu