Eliminating correct distractors
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 }
If you'd like to ensure that the distractors created do not match the correct answer, offer a sequence of while loops, citing each answer to a distractor and directing a precursor variable to be re-randomized
example: in a question with correct answer = v and distractors 2-8 (d2, d3, ... d8), where the distractors are configured with m_1 among other variables
//v and distractors aren't equal
while(v == d2){
m_1 = hws_random(1000.0,1500.0,2.0,1000.0);
}
while(v == d3){
m_1 = hws_random(1000.0,1500.0,2.0,1000.0);
}
while(v == d4){
m_1 = hws_random(1000.0,1500.0,2.0,1000.0);
}
while(v == d5){
m_1 = hws_random(1000.0,1500.0,2.0,1000.0);
}
while(v == d6){
m_1 = hws_random(1000.0,1500.0,2.0,1000.0);
}
while(v == d7){
m_1 = hws_random(1000.0,1500.0,2.0,1000.0);
}
while(v == d8){
m_1 = hws_random(1000.0,1500.0,2.0,1000.0);
}
There is also an (automatic) redundancy checker built into Quest that should weed out duplicate distractors.