Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

If you're ready to make your own questions, you may come across the situation where a distractor calculation is also a correct answer.  If this is left unchecked, students will see some duplicate (correct) answers, where only one will be counted correct.  There's a code line that tells the system to keep cycling the parameter sets if this is the case.  

while(var1 == var2){ re-randomize var1 }

Note, this is for TeX & (C or Javascript) questions.

You may see this in question: 222778

Notice in the lower code box

two variables, a and k, are to be different (even if the function to generate a random number is the same).


//a and k aren't equal

(the // is a way of making notes–the following is describing how to ensure that teh two variables a and k are not equal)


while(a == k){

k = Math.floor(Math.random() * 8 + 2);

}


to generalize

while(var1 == var2){ action to re-randomize var1 }




  • No labels