ID:               25639
 Updated by:       [EMAIL PROTECTED]
 Reported By:      adamm at nycap dot rr dot com
-Status:           No Feedback
+Status:           Closed
 Bug Type:         Scripting Engine problem
 Operating System: windows
 PHP Version:      4.3.3
 New Comment:

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.




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

[2003-10-08 09:30:00] paul dot vaughan at weston dot ac dot uk

I was having this problem (PHP 4.3.3 on WinNT 4) but in response to
[EMAIL PROTECTED]'s question, the function 'srand()' does indeed fix the
problem.

The code:
for ($j=1; $j<10001; $j++) {
   print (rand(0, $j)."<br>");
}
...produced the same ten thousand random numbers each and every time.
Putting srand() before the loop stopped this happening.

I hope this info is useful to someone; not sure anyone will read
this...!

Vaughany.

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

[2003-09-29 05:55:49] [EMAIL PROTECTED]

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.



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

[2003-09-23 22:29:00] [EMAIL PROTECTED]

Does this happen if you call srand() prior to calling the rand()
function?

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

[2003-09-23 18:37:38] adamm at nycap dot rr dot com

I downgraded to 4.3.2 and I dont have this problem. I also found
several posts on the net about many people on Win XP having this
problem with 4.3.3.

Definate bug id say.

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

[2003-09-23 18:21:40] adamm at nycap dot rr dot com

Description:
------------
I am developing on a newly setup Windows XP Box running PHP 4.3.3 on
IIS as CGI.

The rand() function is not generating random numbers. Even with a
min/max declared it will only once generate a number in that range...
and than any other time called (even across browser sessions) it will
always and forever generate the same number.

The code below is broken down to the smallest example possible.

Reproduce code:
---------------
<?php
echo rand();
?>

Expected result:
----------------
I expect to see a random number.

Actual result:
--------------
The same number is always displayed.


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


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

Reply via email to