I have a script that sets a variable and uses it to change the order of a correct answer.
Out of 15 calls to this script, Here's the spread:
Result number w/this result
0 10
1 4
2 1
3 0
This has been the CONSISTANT result. The majority get grouped in ZERO, and RARELY hit 3 (but they DO hit 3)
What am I doing wrong?
Here's what I loop to check the value:
$pos = rand(0,3);
$j = 0;
for ($i=0; $i<4; $i++)
{
if ($pos == $i) {
// this is the correct one!
echo "<input type=\"radio\" value=\"1\" name=\"r1\">";
echo $myq->anscorrect, "<br>";
} else {
echo "<input type=\"radio\" name=\"r1\" value=\"0\">";
$j++;
if ($j == 1) echo $myq->ans1, "<br>";
if ($j == 2) echo $myq->ans2, "<br>";
if ($j == 3) echo $myq->ans3, "<br>";
} // elseif pos = $i;
} // for i