[PHP-DOC] Bug #12550 Updated: rand() and mt_rand() don't behave as documented From: sniper <email protected>
Date: 08/09/01

ID: 12550
Updated by: sniper
Reported By: sulka <email protected>
Old Status: Open
Status: Closed
Bug Type: Documentation problem
Operating System: N/A
PHP Version: 4.0.6
New Comment:

I have committed yet another fix for this..

--Jani

Previous Comments:
------------------------------------------------------------------------

[2001-08-08 16:59:08] tom <email protected>

Reopened, since DSSSL doesn't act as expected, and I'm not allowed to do a workaround.

------------------------------------------------------------------------

[2001-08-06 17:09:31] tom <email protected>

IT's changes in the CVS, and will be online tomorrow...

------------------------------------------------------------------------

[2001-08-03 21:09:30] sniper <email protected>

The documentation is wrong. The proto is this:

mt_rand([int min, int max])

--Jani

------------------------------------------------------------------------

[2001-08-03 08:13:29] sulka <email protected>

In PHP documentation rand() and mt_rand() parameters are
specified as "([int min [, int max]])" which implies max is
optional when min is specified, so that rand(256) would
return a number ranging from 256 to getrandmax().

This is not supported however. Looking at rand.c, it looks
like the author partially implemented this and forgot to
add the relevant code to the portion that parses the
parameters on both functions.

------------------------------------------------------------------------

Edit this bug report at http://bugs.php.net/?id=12550&edit=1