#25639 [Opn->Fbk]: problem with rand()
| From: | iliaa@php.net | Date: | Wed, 24 Sep 2003 02:29:01 +0000 |
| Subject: | #25639 [Opn->Fbk]: problem with rand() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-48024@lists.php.net to get a copy of this message | ||
ID: 25639
Updated by: iliaa@php.net
Reported By: adamm at nycap dot rr dot com
-Status: Open
+Status: Feedback
Bug Type: Scripting Engine problem
Operating System: windows
PHP Version: 4.3.3
New Comment:
Does this happen if you call srand() prior to calling the rand()
function?
Previous Comments:
------------------------------------------------------------------------
[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