我编写以下代码纯粹是为了尝试学习PHP的rand()函数:
<?php
for ($i=0 ; ;$i++ )
{
$a = rand (1, 1000);
$b = rand (1, 1000);
if ($a == $b)
{
echo "A and B variables matched at the number $a which was try number $i on the counter";
break;
}
else
{
echo "Variable a is $a and Variable b is $b on try number $i<br />";
}
}
?>
所谓的随机数总是匹配五个数字中的一个--458,1722,886,202或1282.
我的代码或rand()函数有问题吗?