mt_randGenerate a random value via the Mersenne Twister Random Number Generator Description
int mt_rand()
int mt_rand(int
$min , int $max )Many random number generators of older libcs have dubious or unknown characteristics and are slow. The mt_rand function is a drop-in replacement for the older rand. It uses a random number generator with known characteristics using the » Mersenne Twister, which will produce random numbers four times faster than what the average libc rand() provides.
If called without the optional Caution
This function does not generate cryptographically secure values, and must not be used for cryptographic purposes, or purposes that require returned values to be unguessable. If cryptographically secure randomness is required, the Random\Randomizer may be used with the Random\Engine\Secure engine. For simple use cases, the random_int and random_bytes functions provide a convenient and secure API that is backed by the operating system’s CSPRNG. Parameters
Return Values
A random integer value between Changelog
Examples
Example #1 mt_rand example
The above example will output something similar to: 1604716014 1478613278 6 NotesWarning
See Also
|