You are here : phpmathmt_getrandmax

mt_getrandmax() - math

Returns the maximum value that can be returned by a call to mt_rand().


Syntax

int mt_getrandmax
     ( void
    )


Example

<?phpfunction randomFloat($min = 0, $max = 1) {    return $min + mt_rand() / mt_getrandmax() * ($max - $min);}var_dump(randomFloat());var_dump(randomFloat(2, 20));?>


Output / Return Value


Limitations


Alternatives / See Also


Reference