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:[EMAIL PROTECTED]] 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



---
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
 

--
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