ID:               37409
 Updated by:       [EMAIL PROTECTED]
 Reported By:      Kazeuri at Gmail dot com
-Status:           Open
+Status:           Feedback
-Bug Type:         Unknown/Other Function
+Bug Type:         Math related
 Operating System: SUSE 10
 PHP Version:      4.4.2
 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.

Please provide a reproduce code without use of image*() functions.


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

[2006-05-11 15:44:25] Kazeuri at Gmail dot com

Description:
------------
rand and mt_rand (which, no longer need to be seeded...) get stuck on
the same "result" after a certain number of generations. I am unsure
exactly why this is, and PLEASE, read in to this, its very easy at
first to view this as a mistake, but according to all the documentation
I have read, this should NOT occur.

Reproduce code:
---------------
header("Content-type: image/png");
$stext = "some text";
$x = 800;
$y = 600;
$im = @imagecreate($x, $y) or die("Cannot Initialize new GD image
stream");
$background_color = imagecolorallocate($im, 0, 0, 0);
$stnum = 0;

while ($stnum <= 125){
        $stize = rand(0,5);
        $xl = rand(0,800);
        $yl = rand(0,600);
        $text_color = imagecolorallocate($im, mt_rand(0,255), mt_rand(0,255),
mt_rand(0,255));
        imagestring($im, $stize, $xl, $yl,  $stext, $text_color);
        $stnum += 1;
}
imagepng($im);
imagedestroy($im);

Expected result:
----------------
An image with randomly generated text all over it in various places
(random).

Actual result:
--------------
This works fine, for about 50 results or so, and then somehow, ALL
THREE rand functions that contribute to the text color get "stuck" and
one particular color begins to dominate (which changes randomly each
time it is generated).


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


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

Reply via email to