ID: 43171 Updated by: [EMAIL PROTECTED] Reported By: bdew at druzya dot org -Status: Open +Status: Bogus Bug Type: Math related Operating System: windows xp sp2 PHP Version: 5.2.4 New Comment:
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Thank you for your interest in PHP. Previous Comments: ------------------------------------------------------------------------ [2007-11-01 13:54:24] bdew at druzya dot org Err, sory... "If i use rand(x,y) the bug does happen only when max_rand+2>y>max_rand+2" should have read "If i use rand(x,y) the bug does happen only when max_rand+2>y>max_rand-2" ------------------------------------------------------------------------ [2007-11-01 13:30:23] bdew at druzya dot org Description: ------------ Under windows xp cli version, rand() seems to return cycling values in lower bits. If i use rand(x,y) the bug does happen only when max_rand+2>y>max_rand+2 mt_rand() is unaffected Tested same code under linux cli and the bug doesn't happen. possibly related to http://bugs.php.net/bug.php?id=43108 Reproduce code: --------------- $a=rand() & 0xff; for ($k=0;$k<10;$k++) { $i=0; do { $i++; $b=rand() & 0xff; } while ($a!=$b); echo("cycle: $i\n"); }; Expected result: ---------------- 10 lines with "cycle: x", x being different every line Actual result: -------------- cycle: 256 cycle: 256 cycle: 256 cycle: 256 cycle: 256 cycle: 256 cycle: 256 cycle: 256 cycle: 256 cycle: 256 every time ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43171&edit=1
