WEISD wrote:
> 
>>
>> Computer functions to generate random numbers are not designed to do
>> what their name suggests.
>>
>> Software testing requires repeatability, and this includes random
>> number generation.
>>
>> Without knowing how PHP seeds the generator it is difficult to predict
>> what it will do.
>>
>> I still think taking the last digit of the current time is your best
>> solution.
>>
>> Stephen
> 
> I like the idea of using the time but don't like the idea of spending
> the rest of the day learning how to parse out the numbers I need from
> the time...
> 

Really, you think this step is difficult?

Try looking at the page http://php.net/date it will give you all that you need.

$second = (int)date('s');

This will give you the current second of the current minute of the current ....

Anyways.

Take that and run it through a modulo then add one to keep it within the 1-10.

<?php

$second = (((int)date('s')) % 10) +1;

echo $second;

?>

This should do

-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare


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

Reply via email to