Home Menu

rand

Generate a random integer

Syntax

rand ( void ) : int
rand ( int $min , int $max ) : int

Parameters

min

The lowest value to return (default: 0)

max

The highest value to return (default: getrandmax())

Return

A pseudo random value between min (or 0) and max (or getrandmax(), inclusive).

Examples

void

<?

$return = rand();

echo $return;

?>
1503483774

min max

<?

$min = -10;
$max = 10;

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

echo $return;

?>
8

PHP

JesusBible
HTMLCSSJSPHPSVGMore
AboutTerms