Personally I like to use mt_rand() rather than rand() as it's billed to be
faster and more random than plain old rand().

Kind of makes me wonder why they haven't just replaced rand() with
mt_rand()...

"seed" requires srand() for rand() and mt_srand() for mt_rand().


--
Plutarck
Should be working on something...
...but forgot what it was.


""Dddogbruce (@home.com)"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Alrighty.  I'm baack!  Anyways, I seem to be having stupid little
> problems, al of which are driving me insane.  I'll feel really
> stupid when you tell me the problem.  A friend told me something about
> "seeding" for random() but I didn't find anything on that.
>
> This is the HTML section...
>
> <HTML>
> <HEAD>
> <TITLE>Horse Race v.1</TITLE>
> </HEAD>
> <BODY>
> Welcome to horse racing v.1.  This is a simple PHP game where you can
> train, race and win money for your animals.  Eventually I'll make it a
> whole barn with feeding and horses, and costs, age, breeding.  So on.
> But for now, this is just a simple game.<br><br>
>
> Enter six names of horses.
> <FORM ACTION="horse.php" METHOD="post">
> Name1 : <INPUT TYPE="text" NAME="name1" size="24"><BR>
> Name2 : <INPUT TYPE="text" NAME="name2" size="24"><BR>
> Name3 : <INPUT TYPE="text" NAME="name3" size="24"><BR>
> Name4 : <INPUT TYPE="text" NAME="name4" size="24"><BR>
> Name5 : <INPUT TYPE="text" NAME="name5" size="24"><BR>
> Name6 : <INPUT TYPE="text" NAME="name6" size="24"><BR>
> <input type="submit" name="submitNms" value="race them!">
> </FORM>
> <center>Good luck!
> </BODY>
> </HTML>
>
> ----------------
>
> This is the PHP...
>
> <?
> $name1 = "$n1";
> $name1 = "$n2";
> $name3 = "$n3";
> $name4 = "$n4";
> $name5 = "$n5";
> $name6 = "$n6";
> $randomHorse = rand($name1, $name6);
> $randomStrides = rand(1, 10);
> echo "$randomHorse won the race by $randomStrides !  Congratulations.";
> ?>
>
>
> -------------------
>
> And I feel stupid.  <g>
>
> -Owen
>
>
> --
> PHP General 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]
>



-- 
PHP General 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]

Reply via email to