note 103115 deleted from function.rand by danbrown
| From: | danbrown@php.net | Date: | Sat, 26 Mar 2011 13:00:54 +0000 |
| Subject: | note 103115 deleted from function.rand by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-178237@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
<?
$b=array();
for($y=0;$y<10000;$y++){$b[rand(0,5)]++;}
$r="Rand: ";
for($y=0;$y<count($b);$y++){$r.=$y.":".$b[$y]."; ";}
echo $r;
?>
Rand: 0:330; 1:2021; 2:1899; 3:1878; 4:1971; 5:1901;
Rand: 0:284; 1:1947; 2:1970; 3:1861; 4:2044; 5:1894;
Rand: 0:276; 1:1917; 2:1989; 3:1979; 4:1921; 5:1918;
Rand: 0:278; 1:1957; 2:1898; 3:1999; 4:1895; 5:1973;
Rand: 0:262; 1:1923; 2:1988; 3:1933; 4:1959; 5:1935;
Rand: 0:277; 1:1937; 2:1923; 3:1945; 4:1982; 5:1936;
And this is supposed to be random?
Key 0 is used quite fewer than the other number, which are higher than zero!?
martin
www.mshd.net