note 14790 added to function.srand.php
| From: | php-general at lists dot php dot net | Date: | Wed, 15 Aug 2001 02:14:59 +0000 |
| Subject: | note 14790 added to function.srand.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-16738@lists.php.net to get a copy of this message | ||
I have a ramdon circulater that changes a piece of text once a day, and I use the following code to
make sure the see is unique enough.
$tm = time();
$today = mktime(0, 0, 0, (int)date("n", $tm), (int)date("j", $tm),
(int)date("Y", $tm));
srand($today / pi());
The pi works wonders for the whole thing and it works like a charm. Any other big decimal number
will do as well, but pi is the most common "big" number.
http://www.php.net/manual/en/function.srand.php