Randomized texts - mkraska/meclib GitHub Wiki
Sometimes you don't want to specify numbers but want to describe the task using text.
This can be randomized using a random index for access to a template list. The list contains factors and textual descriptions of these factors.
Question variables
template: [
[ 2, "auf das Doppelte erhöht" ],
[ 1.1, "um 10% erhöht" ],
[ 1.5, "um 50% erhöht" ],
[ 0.5, "auf die Hälfte vermindert" ],
[ 0.9, "um 10% vermindert" ]
];
Let's say you have a quantity L.
Liis the random list index.Ltextis the text to be used in the question text.Lfactoris the factor represented by the text.
Now assume that the result is proportional to the square root of L.
Laufis to how many % the result changes.Lumis by how many % the result changes.
It is not recommended to randomize also the question of 'to' or 'by', because this might get complicated with feedback.
Lexp: -0.5;
Li: rand(length(template))+1;
Ltext: template[Li][2];
Lfactor: template[Li][1];
Lauf: Lfactor^Lexp*100;
Lum: (Lfactor^Lexp-1)*100;
Question text
<p>Um wieviel % (mit Vorzeichen) ändert sich die Eigenfrequenz eines mathematischen Pendels,</p>
<p>a), wenn die Länge {@Ltext@} wird? [input:ans1](/mkraska/meclib/wiki/input:ans1)% [validation:ans1](/mkraska/meclib/wiki/validation:ans1) [feedback:prt1](/mkraska/meclib/wiki/feedback:prt1)</p>
Input and PRT
Use Lauf or Lum as model solution and teacher's answer, depending on what your actual question was.