Home Menu

mt_rand

Generate a random value via the Mersenne Twister Random Number Generator

Syntax

mt_rand ( void ) : 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

void

<?

$return = mt_rand();

echo $return;

?>
2058105399

min max

<?

$min = -10;
$max = 10;

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

echo $return;

?>
8

PHP

JesusBible
HTMLCSSJSPHPSVGMore
AboutTerms