php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #12550 rand() and mt_rand() don't behave as documented
Submitted: 2001-08-03 08:13 UTC Modified: 2001-08-12 17:35 UTC
From: sulka at sulake dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.0.6 OS: N/A
Private report: No CVE-ID: None
 [2001-08-03 08:13 UTC] sulka at sulake dot 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-03 21:09 UTC] sniper@php.net
The documentation is wrong. The proto is this:

mt_rand([int min, int max])

--Jani

 [2001-08-06 17:09 UTC] tom@php.net
IT's changes in the CVS, and will be online tomorrow...
 [2001-08-08 16:59 UTC] tom@php.net
Reopened, since DSSSL doesn't act as expected, and I'm not allowed to do a workaround.
 [2001-08-09 01:56 UTC] sniper@php.net
I have committed yet another fix for this..

--Jani

 [2001-08-09 03:17 UTC] sniper@php.net
Reopened. My workaround wasn't accepted either. :)

--Jani

 [2001-08-12 17:35 UTC] jeroen@php.net
Fixed. Hope this _is_ accepted...

--Jeroen
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 07:01:32 2024 UTC