Hi April,

You need to plant seeds to reach this goal, it discusses this in manual   
under rand() and mt_rand() so have a look here :

    http://www.php.net/manual/en/function.rand.php

Which links to and talks about srand :

    http://www.php.net/manual/en/function.srand.php

A seedless rand() is essentially useless.  Examples exist in the above,   
check out the user comments.

Philip

On Fri, 26 Jan 2001, April wrote:

> I have this scriptlet:
> 
> $items = 6;
> $randnum = rand(1,$items);
> echo $randnum . "<br><br>";
> 
> Always, no matter how many times I hit refresh, it'll always return the
> lowest possible value, in this case 1.  If I have rand(4,$items), it returns
> four.
> 
> So I tried mt_rand(), with this:
> 
> $items = 6;
> $randnum = mt_rand(1,$items);
> echo $randnum . "<br><br>";
> 
> This always, without fail, returns the highest possible value.  6 in this
> case.
> 
> I'm using Apache/4.0.3pl1 on Windows 2000, locally, just to develop.  Could
> this be a cache type problem?  Could the gods be conspiring to drive me
> steadily insane?
> 
> April
> 
> 
> -- 
> 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]
> 


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