PHP rand() Function is used to generate a random integer number. A rand() function is built-in function in PHP.
rand(int $min, int $max);
$min : Optional. It is the lowest number. Default is 0.
$max : Optional. It is the highest number.
Return Values :
It returns integer numbers randomly between min (or 0) and max (or getrandmax()).
The rand() function is an alias of mt_rand(). The mt_rand() function generates random value and is 4 times faster than rand().
Let's see below example to understand php rand() Function in details.