<?
print(getrandmax());
?>
integer mt_getrandmax()
The mt_getrandmax function returns the maximum random number that may be returned
by the mt_rand function.
<?
print(mt_getrandmax());
?>
double lcg_value()
The lcg_value function returns a number between 0 and 1 using an algorithm called a
linear congruential generator, or LCG. This is a common method for generating
pseudorandom numbers. The generator is seeded with the process identifier.
integer mt_rand(integer min, integer max)
The mt_rand function uses the Mersenne Twister algorithm to return a number between
the two optional arguments, inclusive. If left out, zero and the integer returned by the
mt_getrandmax function will be used. Use mt_srand to seed the Mersenne Twister
random number generator.
<?
//seed the generator
mt_srand(time());
//get ten random numbers from 1 to 100
for($index = 0; $index < 10; $index++)
{
print(mt_rand(1, 100). "
\n");
}
?>
mt_srand()
The mt_srand function seeds the Mersenne Twister random number generator. It is best
to call this function once before using the mt_rand function.