rand()


int rand ( [ int $min, int $max ] )

Description

rand() generates a random number between $min and $max

※ available F/W version : all

Parameters

Return values

Returns a random number between $min and $max, PHP error on error

Example

<?php
echo (string)rand() . "\r\n";         // OUTPUT: random number (0 ~ 9223372036854775807)
echo (string)rand(10) . "\r\n";      // OUTPUT: random number (10 ~ 9223372036854775807)
echo (string)rand(5, 15) . "\r\n";  // OUTPUT: random number (5 ~ 15)
?>

See also

None

Remarks

This function is identical to the PHP group’s rand() function except output value range and number of input parameter.