Random pictures - not twice

From: Date: Sun, 03 Dec 2006 22:20:17 +0000
Subject: Random pictures - not twice
Groups: php.general 
Request: Send a blank email to php-general+get-245466@lists.php.net to get a copy of this message
Hi there! I have created a script the generates random pictures... <?php //Random pictures // $pictures[0] = "bil1.gif"; $pictures[1] = "bil2.gif"; $pictures[2] = "bil3.gif"; $pictures[3] = "bil4.gif"; for ($i=0;$i<3;$i++) { $r = rand(0,3); ?> <p>&nbsp;&nbsp;<img src="<?php echo $pictures[$r];?>"></p> <?php } ?> With this above script the same picture can be shown twice. Is there any smart way of avoiding this without having to rely on cookies/sessionids? Best regards /Gustav Wiberg Stammis Internet - http://www.stammis.com/ - pedigrees on the net

« previous php.general (#245466) next »