Posted by Philip Ronan on 11/10/05 20:13
"Nel" wrote:
> The problem is displaying the contents of an array in what appears to be
> random order, but in fact is a set sequence depending on a given value (e.g.
> the day of the month).
(snip)
> The order itself is not important, but what is important is the apparent
> random sequence is really repeatable.
Seed the random number generator based on the day of the month and use
array_rand() to shuffle the contents
$day = 1 * date('j');
srand($day);
$random_array = array_rand($array);
(I haven't tested this, but it ought to work)
--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/
[Back to original message]
|