frieza |
04-09-2009 03:20 PM |
question about seeding mt_rand in php
here's a simple script i wrote using gdlib rendering to create a random forum sig for other forums (no img tags in this forum
Code:
<?php
$me = mt_rand(1,78);
$pic=imagecreatefromjpeg($me.".jpg");
list($width, $height, $type, $attr) = getimagesize($me.".jpg");
$layer = imagecreatetruecolor ( 250 , 250 );
$blue = imagecolorallocate ( $layer , 0 , 0 , 0 );
imagefill($layer,0,0,$blue);
$white = imagecolorallocate ( $layer , 204 , 255 , 255 );
imagecopyresampled ( $layer , $pic , 0 , 35 , 0 , 0 , 250 , 215 , $width , $height );
imagefttext($layer,25,0,60,30,$white,"./Norasi-Oblique.ttf","HOPPER" );
header("Content-type: image/jpeg");
imagejpeg($layer);
imagedestroy($layer);
imagedestroy($pic);
?>
granted i know seeding the random number generator is no longer explicitly necessary, but how could i seed the random number to decrease the likelyhood of duplicates when this script is called multiple times from the same page?
|