note 13588 deleted from function.rand.php by philip
| From: | philip@php.net | Date: | Sun, 26 Aug 2001 10:55:24 +0000 |
| Subject: | note 13588 deleted from function.rand.php by philip | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-17158@lists.php.net to get a copy of this message | ||
I've only begun programming in PHP so there's probably a better way, but here's a
Random Powerball picker example:
<h2>
Your Lucky PowerBall Number:<br>
<?
//seed the random generator
srand((double)microtime()*1000000);
//choose the 5 main numbers 1-49
for($p = 1; $p <= 5; $p++) {
echo(rand(1,49)), " - ";
}
?>
<font color="red">
<?
//choose the powerball number 1-45 displayed in red
echo(rand(1,45));
?>
</font>
</h2>