September 2001
Intermediate to advanced
768 pages
32h 45m
English
int mt_rand(int min, int max)
Generates a random integer using the Mersenne Twister algorithm.
Returns:
Random integer
Description:
Calling this function without any arguments produces a random number between zero and the system’s maximum Mersenne Twister value. The maximum value can be found by calling mt_getrandmax(). Passing both the min and max arguments generates a number within the provided range.
Whereas rand() uses the standard libc rand() function, which can be slow and doesn’t have a set of known characteristics, mt_rand() uses the Mersenne Twister algorithm to generate a random number that’s more suitable for cryptography because of its known characteristics. This function can also be up to four times faster than the standard ...
Read now
Unlock full access