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;

?>
1435604821

min max

<?

$min = -10;
$max = 10;

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

echo $return;

?>
3

PHP

Home Menu