ID: 27919 Updated by: [EMAIL PROTECTED] Reported By: kingoleg at mail dot ru -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: windows PHP Version: 4.3.4 New Comment:
This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. RAND_MAX is [about] 32768 on windows. 'echo getrandmax()' should give you that value. That is the value used for the 'max' argument _if one is not specified_. That's not to say a larger max cannot be used, RAND_MAX is the default. As the manual says, "If called without the optional min, max arguments rand() returns a pseudo-random integer between 0 and RAND_MAX." The note was a bit deceiving as it is entirely possible to specify a range much larger than 32768. Previous Comments: ------------------------------------------------------------------------ [2004-04-08 07:30:50] kingoleg at mail dot ru Description: ------------ I have found a bug on page http://www.php.net/manual/en/function.rand.php [chm date: 2003-09-06]: "On some platforms (such as Windows) RAND_MAX is only 32768. If you require a range larger than 32768, consider using mt_rand() instead." It is not correct for example on WinXp. Reproduce code: --------------- <?php echo rand(11111111111111,222222222222222222); ?> Expected result: ---------------- first run: 127534874 (it is >larger than 32768) second run 59053744 (it is >larger than 32768) Actual result: -------------- I think, that word "range" in this note is from early PHP version, when syntax was rand(start, rand). Now it rand(start, end). I think, that words "such as Windows" must be replaced with "such as early versions of Windows". Or, this note can be fully rewrited. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27919&edit=1
