← All built-ins / mt_rand()
mt_rand()
mt_rand(...$args): float
Parameters
| Name | Type | Description |
|---|---|---|
| $min | int | lower boundoptional |
| $max | int | upper boundoptional |
Return value
Mersenne-Twister pseudo-random integer (faster than rand, still not secure).
Example
$v = mt_rand(0, 100); echo $v >= 0 && $v <= 100 ? "ok" : "bad";
ok