Name
rand()
Synopsis
int rand ( [intmin, intmax] )
The rand() function returns random numbers. If you call it with no parameters, it will return a number between 0 and the value returned by getrandmax().
If you supply it with two parameters, rand() will use those numbers as the upper and lower limits of the random number, inclusive of those values. That is, if you specify 1 and 3, the value could be 1, 2, or 3.
$random = rand();
$randrange = rand(1,10);Using rand() is very quick but not very "random"—the numbers it generates are more predictable than using the mt_rand() function.
The maximum value that can be generated by rand() varies depending on the system you use: on Windows, the highest default value is usually 32,767; on Unix, the value is 2,147,483,647. That said, your system may be different, which is why the getrandmax() is available.