note 103042 added to function.mt-rand
| From: | alex at khimic dot removeit dot h dot com | Date: | Tue, 22 Mar 2011 12:16:04 +0000 |
| Subject: | note 103042 added to function.mt-rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-178073@lists.php.net to get a copy of this message | ||
This function really generates randow string. One can check it using this:
<?php
header("Content-type: image/png");
$img = imagecreatetruecolor(500,500);
$ink = imagecolorallocate($img,255,255,255);
for($i=0;$i<500;$i++) {
for($j=0;$j<500;$j++) {
imagesetpixel($img, mt_rand(1,500), mt_rand(1,500), $ink);
}
}
imagepng($img);
imagedestroy($img);
?>
This generates 500x500 image with pixel noise.
If you switch mt_rand(1,500) to rand(1,500) you will NOT get pixel noise.
----
Server IP: 69.147.83.197
Probable Submitter: 46.227.136.226
----
Manual Page -- http://www.php.net/manual/en/function.mt-rand.php
Edit -- https://master.php.net/note/edit/103042
Del: integrated -- https://master.php.net/note/delete/103042/integrated
Del: useless -- https://master.php.net/note/delete/103042/useless
Del: bad code -- https://master.php.net/note/delete/103042/bad+code
Del: spam -- https://master.php.net/note/delete/103042/spam
Del: non-english -- https://master.php.net/note/delete/103042/non-english
Del: in docs -- https://master.php.net/note/delete/103042/in+docs
Del: other reasons-- https://master.php.net/note/delete/103042
Reject -- https://master.php.net/note/reject/103042
Search -- https://master.php.net/manage/user-notes.php