[thelist] srand in php

Jay Greenspan jay at trans-city.com
Tue Oct 23 18:43:55 CDT 2001

On Tuesday, October 23, 2001, at 06:43 PM, noah wrote:

> Does anyone know if there's a better way to get 8 random true or false 
> values?

I don't know if this is any better, but since 0 will test false an 1 
will test true, this will give you an 8 element array of random true and 
false values:

for($i=0; $i<=7; $i++){
     $keys[$i] = mt_rand(0,1);


More information about the thelist mailing list