Re: I'm a moron. So?
| From: | Plutarck | Date: | Sat, 21 Apr 2001 18:43:59 +0000 |
| Subject: | Re: I'm a moron. So? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-49692@lists.php.net to get a copy of this message | ||
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)"" <ddogbruce@home.com> wrote in message
news:3AE0F382.9E8588CF@home.com...
> 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: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>