The mt_rand Function
The mt_rand
function generates a random
integer within a specified range.
Syntax
mt_rand(from which number, to which number);
Example
Let's generate a random number from 5
to 15
:
<?php
echo mt_rand(5, 15);
?>
See Also
-
the
str_shuffle
function,
which shuffles the characters of a string in random order -
the
array_rand
function,
which selects random values from an array -
the
shuffle
function,
which shuffles the elements of an array