The mt_rand() function is used to generate random numbers. The numbers are generated using the Mersenne Twister algorithm.
Note − This function is faster than the rand() function
Syntax
mt_rand() or mt_rand(min, max)
Parameters
min − Default is 0.The lowest number to be Returned.
max − The highest number to be Returned.
Return
The mt_rand() function Returns a random integer between min (or 0) and max. FALSE is Returned if max < min.
Example
<?php echo mt_rand(100, 200); ?>
Output
144
Example
Let us see another example −
<?php echo mt_rand(); ?>
Output
132850920