Bug #12550 Updated: rand() and mt_rand() don't behave as documented

From: Date: Mon, 06 Aug 2001 21:09:31 +0000
Subject: Bug #12550 Updated: rand() and mt_rand() don't behave as documented
References: 1  Groups: php.dev php.doc 
Request: Send a blank email to php-dev+get-62348@lists.php.net to get a copy of this message
ID: 12550
Updated by: tom
Reported By: sulka@sulake.com
Old Status: Analyzed
Status: Closed
Bug Type: Documentation problem
Operating System: N/A
PHP Version: 4.0.6
New Comment:

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

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

[2001-08-03 21:09:30] sniper@php.net

The documentation is wrong. The proto is this:

mt_rand([int min, int max])

--Jani


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

[2001-08-03 08:13:29] sulka@sulake.com

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



Thread (20 messages)

« previous php.dev (#62348) next »