|
|
PHP mt_rand() - Math Functions
|
Tutorials » Php »
|
Topic |
What is mt_rand Function?
|
|
Explanation |
|
The "mt_rand()" function returns a random value between the range using the Mersenne Twister algorithm.
Syntax:
mt_rand(min,max)
In the above syntax "min", "max" values specifies the lowest and highest range from which the random value to be returned.
Example:
<?php
echo mt_rand() . "\n";
echo mt_rand() . "\n";
echo mt_rand(4, 18);
?>
Result:
1704545873
1573575755
7
In the above example the first the random values are returned without parameters, in the other statement a random
number is displayed between "4" and "18".
|
|
A Note |
Learn PHP programming language tutorial with simple and neat example. Hope you enjoy this free tutorial.
Do give us your valuable feedback and suggestions on this online tutorial. This is a Copyright Content.
|
|
|
|