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

mt_rand

Description

The mt_rand of Random for PHP generate a random value via the Mersenne Twister Random Number Generator.

Syntax

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

Parameters

min

Optional lowest value to be returned (default: 0)

max

Optional highest value to be returned (default: mt_getrandmax())

Return

A random integer value between min (or 0) and max (or mt_getrandmax(), inclusive), or false if max is less than min.

Examples

1 · void

<?

$return = mt_rand();

echo $return;

?>
1264115251

2 · min max

<?

$min = -10;
$max = 10;

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

echo $return;

?>
6
HomeMenu