getrandmax

int getrandmax(void) 

Returns the maximum random number possible, as defined by the system’s RAND_MAX value.

Returns:

Maximum random value

Description:

getrandmax() returns the maximum value that rand() can produce. This function is basically a utility function, but can have application when manipulating numbers produced by rand().

This function cannot fail.

Version:

PHP 3, PHP 4

See also:

mt_getrandmax() 
mt_rand() 
mt_srand() 
rand() 
srand() 

Example:

Get the maximum value returnable by rand()
echo "Max value of rand() is: ", getrandmax(); 

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.