note 38675 added to function.srand

From: Date: Fri, 02 Jan 2004 15:14:00 +0000
Subject: note 38675 added to function.srand
Groups: php.notes 
Request: Send a blank email to php-notes+get-62784@lists.php.net to get a copy of this message
Just wanted people to know that I recently upgraded from PHP 4.3.2 to PHP 4.3.4 (on IIS 5) and my random number generator does NOT seem to be automatically seeded, as stated in the documentation above. On one of my sites, I display images based upon rand(1, 75) for the output, which gives me something like 43.gif, for instance. This has always given me different images on each reload, until i switched to PHP 4.3.4. What I did was to simply seed the random number generator with srand((double)microtime() * 1000000) once, in the beginning of my scripts. But my point is that nowadays, using 4.3.4, I have too manually seed it. ---- Manual Page -- http://www.php.net/manual/en/function.srand.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+38675 Delete -- http://master.php.net/manage/user-notes.php?action=delete+38675&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+38675&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#62784) next »