| Random Number Functions | |
|---|---|
| getrandmax() | |
| int getrandmax() | |
| This function returns the largest value that rand() can return. | |
| lcg_value() | |
| double lcg_value() | |
| This function returns a psuedo-random number in the range (0, 1) via a linear congruential algorithm with a period equal to (2^31 - 85)*(2^31 - 249). | |
| mt_getrandmax() | |
| int mt_getrandmax() | |
| This function returns the largest value that mt_rand() can return. | |
| mt_rand() | |
| int mt_rand(int $iMin = 0, int $iMax = mt_getrandmax()) | |
| This function returns a generated random integer in the range from $iMin to $iMax, using the Mersenne Twister algorithm. | |
| Argument | Description |
| int $iMin | This is the minimum value that can be generated. |
| int $iMax | This is the maximum value that can be generated. |
| mt_srand() | |
| int mt_srand(int $iSeed = random_seed, int $iMode = MT_RAND_MT19937) | |
| This function seeds the pseudo-random number generator for the Mersenne Twister generator that is used by mt_rand(). A seed is used to generate a specific consistent sequence of numbers. This is often useful for testing. | |
| Argument | Description |
| int $iSeed | This is the seed value. If it is not set, a random value is used. |
| int $iMode | This helps define the method for generating random numbers. |
| rand() | |
| int rand(int $iMin = 0, int $iMax = getrandmax()) | |
| This function returns a generated random integer in the range from $iMin to $iMax. It has been made an alias of mt_rand() in PHP 7.1.0. | |
| Argument | Description |
| int $iMin | This is the minimum value that can be generated. |
| int $iMax | This is the maximum value that can be generated. |
| srand() | |
| int srand(int $iSeed = random_seed) | |
| This function seeds the pseudo-random number generator for rand(). A seed is used to generate a specific consistent sequence of numbers. This is often useful for testing. In PHP 7.1.0, this is an alias for mt_srand(). | |
| Argument | Description |
| int $iSeed | This is the seed value. If it is not set, a random value is used. |
© 20072026 XoaX.net LLC. All rights reserved.