Hi Dan,
You need to call mt_srand() first to seed the random number generator. It's all
described here:
http://www.php.net/manual/en/function.mt-rand.php
Ken
* Dan Eskildsen <[EMAIL PROTECTED]> [010517 14:22]:
> Newbie alert
>
> Hi! Here is a piece of coding. It randomly choose between four options to
> display on my homepage. The problem is that it doesn't seem to be that
> random - rather biased. The last option $message[3] is displayed 9 out of
> 10 times. Any suggestions?
>
> <script language="php">
>
> $message[0] = '<a href="index.php3?Page=vogn"><img border="0"
> src="images/trolley.jpg"><br>Rengøringsvogne, mopper m.m.</a>';
> $message[1] = '<a href="index.php3?Page=nilfisk"><img border="0"
> src="images/nilfisk.gif"><br>Nilfisk Advance rengøringsmaskiner</a>';
> $message[2] = '<a href="index.php3?Page=polering"><img border="0"
> src="images/ladder.jpg"><br>Har du set vores Vinduespudserstiger?</a>';
> $message[3] = '<a href="index.php3?Page=polish"><img
> border="0"src="images/logo-bison.gif"><br>Vi importerer selv vore polisher
> fra en af Canadas førende Polishfabrikker.</a>';
>
> $number = mt_rand(0,3) ;
> print"$message[$number]";
>
> </script>
>
> --
> ==================================
> Regards from Denmark, Europe
> Please cc your reply to [EMAIL PROTECTED]
> ==================================
> I haven't lost my mind, I've got it backed up on TAPE somewhere.......
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]