Bug #12550: rand() and mt_rand() don't behave as documented
| From: | sulka at sulake dot com | Date: | Fri, 03 Aug 2001 12:13:29 +0000 |
| Subject: | Bug #12550: rand() and mt_rand() don't behave as documented | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-61933@lists.php.net to get a copy of this message | ||
From: sulka@sulake.com
Operating system: N/A
PHP version: 4.0.6
PHP Bug Type: Math related
Bug description: rand() and mt_rand() don't behave as documented
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 bug report at: http://bugs.php.net/?id=12550&edit=1