RE: [PHP] problems with mt_rand()
| From: | Matthew Walker | Date: | Thu, 31 Jan 2002 20:18:53 +0000 |
| Subject: | RE: [PHP] problems with mt_rand() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-82982@lists.php.net to get a copy of this message | ||
Did you remember to seed it?
See http://www.php.net/manual/en/function.mt-srand.php
for info on how
to seed it.
Matthew Walker
Ecommerce Project Manager
Mountain Top Herbs
-----Original Message-----
From: Benjamin deRuyter [mailto:bderuyter@mediaone.net]
Sent: Thursday, January 31, 2002 1:02 PM
To: PHP
Subject: [PHP] problems with mt_rand()
I need to generate a random number (range is not crucial) and I have
been
trying to use mt_rand(). However, I am finding that is generates the
same
value EVERY time. This is true whether I supple a range or not. For
example, the follow line of code generated 13 EVERY time...
$result = mt_rand(1,15);
echo $result;
In addition, this line of code generated 1755202938 EVERY time...
$result = mt_rand();
echo $result;
What am I doing wrong??
- Ben
--
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
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002