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

From: Date: Mon, 13 Aug 2001 15:34:34 +0000
Subject: Re: Bug #12550 Updated: rand() and mt_rand() don't behave as documented
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969337066@lists.php.net to get a copy of this message
> On Mon, 13 Aug 2001, Jeroen van Wolffelaar wrote: > > >> Now you assume that you need to pass arguments to these functions. > >> Which is not the case. Here's the proto: > >> > >> /* {{{ proto int rand([int min, int max]) > >> Returns a random number */ > >> > >> So revert that patch. mt_rand() / rand() accecpt either 2 parameters or > >> none at all. It was at least LESS wrong before. Now it's totally wrong. > > > >_if_ I remember right (not sure), there are now 2 proto's, one with no args, > >and one with2 args. > > Both protos for both mt_rand() and rand() are the same and correct. I never denied that the proto-in-the-source is correct. I've read the source a time ago already, and I know how it works. What I mean is, that in the manual, it says now: rand function synopsis: - rand() - rand(int min, int max) Indicating two possibilities. That's what I was referring to with TWO proto's. This is semantically identical with - rand([int min, int max]) I prefer the latter. I use the word proto in a general meaning: A prototype for that function, I am not specifically referring to the {{{ proto ... in the sources. In this case, I was referring to the protos (2 proto's for rand()) that are currently in the manual. > >That would mean it is correct now, though I agree with you that that proto > >is better. > > It's not the proto that matters here. It's the fact that the functions > happen to WORK like this. Just check the sources yourself. > Both of these functions take either no arguments at all OR 2 arguments. I know, sorry that I was possibly unclear. > >I prefer your patch though, although it is IMO a hack. But the result was > >correct. > > I never claimed it to be the right way to do this but it seems to be the > only way to get the correct result. Unless someone finds a better > solution, of course. ( I dunno docbook that well ) I totally agree: it isn't "right" in the docbook-sense, but <quote>it seems to be the only way to get the correct result</quote> > --Jani Jeroen

« previous php.doc (#969337066) next »