Hi Phil,

> > > How often do you need to call mt_srand(); ?  
> > 
> > once per script, before generating any random 
> > numbers
> 
> I can't just have the user load a file called 
> generate.php which has the mt_srand....and then 
> keep calling random.php (which has mt_rand) without
> calling generate.php   right?

Well, you can if it's in one script :-)

Let's say "random.php" looks like this:
  <?php
    echo mt_rand();
  ?>

and "main.php" looks like this:
  <?php
    include ("generate.php"); // seed 
    include ("random.php");
    include ("random.php");
    include ("random.php");
  ?>

You should be fine. AIUI the call to mt_srand() lasts for the lifecycle of
the script.

Was that what you meant?

Cheers
Jon



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to