ID:               26381
 Comment by:       nunoplopes at sapo dot pt
 Reported By:      spam at vrana dot cz
 Status:           Open
 Bug Type:         Documentation problem
 Operating System: Windows XP
 PHP Version:      4.3.3
 New Comment:

This bug is solved!

I have the latest windows snapshot on windows xp and cli returns a
random value without the need to use srand.


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

[2003-11-28 04:26:47] spam at vrana dot cz

The behavior of rand() really changed in PHP 4.2.0, it is stated in
Changelog. The documentation is correct. And there is coded this
feature in source codes (php-src/ext/standard/rand.c, line 327 in
current CVS). I don't know where the problem is, I don't understand PHP
internals. I can only see that there is global variable rand_is_seeded
set on line 58 and checked on line 326. Maybe the problem is that this
variable wasn't initialized. I'm just guessing because as I wrote, I
don't understand PHP internals.

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

[2003-11-25 08:57:29] [EMAIL PROTECTED]

Manual is wrong.

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

[2003-11-25 08:46:41] spam at vrana dot cz

iliaa, please read the manual yourself before stating bugs as bogus. As
I already wrote here, the manual says:

As of PHP 4.2.0, there is no need to seed the random number generator
with srand() or mt_srand() as this is now done automatically.

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

[2003-11-25 08:41:49] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

For random numbers you MUST call srand() before rand().

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

[2003-11-25 04:53:44] spam at vrana dot cz

Unfortunately it behaves the same with Windows snapshots.

For case it's not obvious from my fist comment - if I call srand()
before rand() it works well.

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/26381

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

Reply via email to