Re: Random number
| From: | Troels Arvin | Date: | Sun, 25 Jun 2000 12:51:15 +0000 |
| Subject: | Re: Random number | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-2974@lists.php.net to get a copy of this message | ||
Eris Ristemena <ste94034@stttelkom.ac.id> wrote:
> how to generate a random number, say from 1 to 10 ?
I choose to interpret that as "an integer between 1 and 10, both
inclusive":
mt_srand((double)microtime()*1000000);
$randval = mt_rand(1,10);
- Which is very close to the manual:
http://www.php.net/manual/function.mt-srand.php
--
Greetings from Troels Arvin, Copenhagen, Denmark