Definition: The rand () function is used to generate a random number in PHP. It can also be used to generate a random number within a specific range (for example a number between 10 and 30.) On a some platforms, Windows for example, if unspecified the largest number that will be generated is 32768, however you can set a specific range to include higher numbers.
<?php print rand() . "<br>"; //generates and prints a random number print rand(10, 30); //generates and prints a random number between 10 and 30 (10 and 30 ARE included) print rand(1, 1000000); //generates and prints a random number between on and one million ?>