ID: 37528 User updated by: lunter at interia dot pl Reported By: lunter at interia dot pl Status: Bogus Bug Type: Math related Operating System: WinXP PHP Version: 5.1.4 New Comment:
Ok.... maybe system dependent ... but MatLab rand() generate perfect noise on WinXP. Previous Comments: ------------------------------------------------------------------------ [2006-05-19 20:54:46] [EMAIL PROTECTED] They are system dependent, it is not a php problem. Now please keep this bug as bogus and read the manual. ------------------------------------------------------------------------ [2006-05-19 20:49:31] lunter at interia dot pl Sorry but.. run this script on Linux PHP - perfect noise run this script on WinXP PHP - pattern! WinXP rand() should be good like Linux rand() Actually rand() is not the same. ------------------------------------------------------------------------ [2006-05-19 20:37:37] [EMAIL PROTECTED] Use mt_rand if you want better random values. ------------------------------------------------------------------------ [2006-05-19 20:35:01] lunter at interia dot pl e.g. MatLab rand() generate perfect noise. ------------------------------------------------------------------------ [2006-05-19 20:26:41] lunter at interia dot pl Description: ------------ rand() weakness. example (reproduce code): rand generate pattern instead of noise Reproduce code: --------------- <? $i=imagecreatetruecolor(1024,768); for($y=0;$y<768;$y++){ for($x=0;$x<1024;$x++){ $c=rand(0,1)*255; imagesetpixel($i,$x,$y,($c<<16)+($c<<8)+$c); } } header('Content-type: image/png'); imagepng($i); ?> Expected result: ---------------- noise Actual result: -------------- pattern ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37528&edit=1