Menu Home

mt_getrandmax

osbo.com | PHP | Functions | mt_getrandmax

Show largest possible random value

Syntax

mt_getrandmax ( void ) : int

Return

Returns the maximum random value returned by a call to mt_rand() without arguments, which is the maximum value that can be used for its max parameter without the result being scaled up (and therefore less random).

Examples

1

<?

$return = mt_getrandmax();

echo $return;

?>
2147483647

2

<?

$return = mt_getrandmax();

$mt_randmin = 0;
$mt_randmax = $return;

$mt_randreturn = mt_rand($mt_randmin, $mt_randmax);

echo $mt_randreturn;

?>
735349009

PHP