random answers
This commit is contained in:
@@ -18,6 +18,19 @@ class WrenchResources extends BaseController
|
|||||||
$b = rand(1,30);
|
$b = rand(1,30);
|
||||||
$c= $a+$b;
|
$c= $a+$b;
|
||||||
|
|
||||||
|
$ansPos = rand(1,4);
|
||||||
|
for ($ii=1; $ii<=4; $ii++){
|
||||||
|
if ($ii== $ansPos){
|
||||||
|
$next_question["option_mix"][]= $c;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
$ansRand = rand(1000,9999);
|
||||||
|
$next_question["option_mix"][]= ($ansRand == $c)? $ansRand+rand(1,5) : $ansRand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$next_question = [
|
$next_question = [
|
||||||
"question" => "What is C ? <br> C = $a + $b .",
|
"question" => "What is C ? <br> C = $a + $b .",
|
||||||
"option" => [ rand(1000,9999), $c , rand(1000,9999)],
|
"option" => [ rand(1000,9999), $c , rand(1000,9999)],
|
||||||
|
|||||||
Reference in New Issue
Block a user