diff --git a/functions/math.xml b/functions/math.xml index b57b25e8d0..5153efd652 100644 --- a/functions/math.xml +++ b/functions/math.xml @@ -530,10 +530,13 @@ $binary = base_convert($hexadecimal, 16, 2); Description int mt_rand - int min - int max + + int min + + + int range + - Many random number generators of older libcs have dubious or unknown characteristics and are slow. By default, PHP uses the @@ -543,24 +546,29 @@ $binary = base_convert($hexadecimal, 16, 2); known characteristics, the Mersenne Twister, which will produce random numbers that should be suitable for cryptographic purposes and is four times faster than what the average libc provides. The - Homepage of the Mersenne Twister can be found at http://www.math.keio.ac.jp/~matumoto/emt.html, - and an optimized version of the MT source is available from - http://www.scp.syr.edu/~marc/hawk/twister.html. - + Homepage of the Mersenne Twister can be found at &url.mersenne;, and an optimized + version of the MT source is available from &url.mersenne.twister;. + - If called without the optional min,max arguments + If called without the optional min, range arguments mt_rand returns a pseudo-random value - between 0 and RAND_MAX. If you want a random number between 5 - and 15 (inclusive), for example, use mt_rand(5,15). + between 0 and RAND_MAX. If you want a + random number between 5 and 15 (inclusive), for example, use + mt_rand (5, 11). + Remember to seed the random number generator before use with - mt_srand. + mt_srand. + See also mt_srand, mt_getrandmax, srand, rand and - getrandmax. + getrandmax. + @@ -732,21 +740,25 @@ $randval = mt_rand(); rand - generate a random value + Generate a random value Description int rand - int min - int max + + int min + + + int range + - - If called without the optional min,max arguments rand() returns a - pseudo-random value between 0 and RAND_MAX. If you want a random - number between 5 and 15 (inclusive), for example, use rand(5,15). - + If called without the optional min,max arguments + rand returns a pseudo-random value between 0 + and RAND_MAX. If you want a random number + between 5 and 15 (inclusive), for example, use rand(5,11). + Remember to seed the random number generator before use with srand. @@ -755,12 +767,11 @@ $randval = mt_rand(); getrandmax, mt_rand, mt_srand and - mt_getrandmax. - + mt_getrandmax. + - round @@ -899,7 +910,7 @@ sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil -sgml-default-dtd-file:"../manual.ced" +sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil