ID:               24050
 Updated by:       [EMAIL PROTECTED]
 Reported By:      ptchristendom at yahoo dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Math related
 Operating System: win32 only
 PHP Version:      4.3.3-dev
 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.

This bug was related to a compilation problem on the shapshot box,
which resulted in incorrect handling of floats.


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

[2003-06-06 02:07:37] [EMAIL PROTECTED]

Can not reproduce within Linux, must be some windows only issue..


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

[2003-06-05 18:15:50] ptchristendom at yahoo dot com

The function mt_rand() has a "preference" for the value 1898087491 for
a majority (but not all) of the default seedings.  As a result, if you
don't seed it you will generate far too many collisions on the value
1898087491.  

If you seed it with values such as 0, 1, 2, 3, etc., the problem will
not occur (these are all the seeds that I tried); however, the mt_rand
should work properly when not seeded.  Further, there SHOULD NOT be any
single seed that causes this value to occur more than others.   This
leads me to believe that mt_rand() is not implemented correctly when
not seeded.

Here it says that it is not necessary to use mt_srand() to obtain
"random" data:
http://us3.php.net/manual/en/function.mt-srand.php

---------------------------------------------------------
The following shows a test script that reproduces the problem:

D:\php4-win32-STABLE-200306052030>type unseeded2.php

<? 
for ($i = 0; $i < 25; $i++) 
  print `php -q unseeded.php`."\n"; 
?>

D:\php4-win32-STABLE-200306052030>type unseeded.php

<?
        $j = 0;
        for ($i = 0; $i < 65536; $i++)
                if (mt_rand() == 1898087491) $j++;
        print $j;
?>

D:\php4-win32-STABLE-200306052030>php unseeded2.php
Content-type: text/html
X-Powered-By: PHP/4.3.3-dev

36480
39710
2308
41576
38524
39247
5005
5449
38011
29808
37577
5738
46785
42418
45619
42322
39296
15909
35019
39127
26830
37223
33348
22713
0


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


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

Reply via email to