Picking and Sorting Variables: max, min, randwrong, randwrong!, randvar, randvar!, sortup, sortdown
max()
To take the max of a list of variables.
Example
min()
To take the minimum of a list of variables.
Example
randwrong()
This is a pretty smart function. It chooses randomly a wrong answer from a list (checking what you have written in the answer box – see next section).
Example
Practical example
You need to calculate a random wrong answer for the Wrong Answers template. Let’s say that our question includes calculating the median. Consequently, you set the calculation of the median in the Question Template.
The median for the randomly changing variables will be calculated automatically as they change. The wrong median for these variables will be calculated automatically as they change if you set the wrong answer function randwrong in the following way.
So in the preview the question and the right and wrong answers to it will look in the following way.
Yet keep in mind that you can only use randwrong() if you need only one wrong answer. randwrong() doesn’t keep track of other randwrong() functions, and if you use randwrong for two or more wrong answers templates, you might get repeating wrong answers outputs like on the pictures below.
randwrong!()
This is an even smarter function. It chooses randomly a wrong answer from a list (checking what you have written in the answer box – see next section), but if you use it repeatedly, it makes sure that each subsequent use is a unique randomly chosen wrong variable!
Example
Practical example
You need to calculate two or more random wrong answers for the Wrong Answers templates. You set the calculation of the median (as in previous example) or any function your question requires. Then, you set randwrong!() and randwrong!!() functions calculation in the Wrong answers templates as per the following.
As a result, you have two random wrong answers calculated, and they set to never repeat each other.
randwrong!!()
This function is similar to randwrong() and randwrong!(). It chooses randomly a wrong answer from a list (checking what you have written in the answer box – see next section) like randwrong() and makes sure that each subsequent use is a unique randomly chosen wrong variable like randwrong!(). Randwrong differs because it is much stricter and it never repeats the values in the output even if the values are repeated in the arguments list.
Practical example
You need to calculate two or more random wrong answers for the Wrong Answers templates. You also want them to be strictly unique and never repeat, also keeping track of each other’s variations.
You set the calculation of the median (as in the previous example) or any function your question requires. Then, you set randwrong!!() function calculation in the Wrong answers templates as per the following.
As a result, you have two random wrong answers calculated, and they set to never repeat each other; the values in the respective answers will not be repeated by themselves as well.
randvar()
Chooses randomly a variable from a list.
Example
Practical example
You have a question where you need your mode to switch randomly. Given that we already work with random values of variables, you want to randomize it even more, but in a way that will allow the system to predict and calculate the correct answer.
In a case like this, the following usage of randvar() and randvar!() might be useful.
Note that randvar() at the beginning of the question set the criteria of unique random variable values for our calculations, so the values in the question would not be repeated, creating the same numeric responses in the table. randvar!() in the table ensures the randomization and uniqueness of each combination of variables for automatic mode calculation, i.e. the mode in the table will never be repeated.
The screenshots below illustrate the impact of randvar() and randvar!() on the variables’ values. Please note that the values of weekly homework time per day are never repeated.
randvar!()
Chooses randomly a variable from a list but if you use it repeatedly, it makes sure that each subsequent use is a unique randomly chosen variable.
Example
Practical example
For randvar!() practical example please see practical example for randvar().
sortup()
Gives the n value from smallest to biggest. Sortup is equivalent to min.
Example
Practical example
Let’s review an example of range usage in question writing. The question is the following.
In the answer template, you type the following functions where sortup1 is the first value in the ascending number (the smallest one) and sortup5 is the last value in the ascending number (the biggest one).
So the output will look as follows.
And the correct answer calculated with the help of the function we established will be
sortdown()
Gives the n value from biggest to smallest. sortdown is equivalent to max.
Example
Practical example
Let’s review an example of range usage in question writing. The question is the following
In the answer template, you type the following functions where sortdown1 is the first value in the descending number (the biggest one) and sortdown5 is the last value in the ascending number (the smallest one).
So the output will look as follows.
And the correct answer calculated with the help of the function we established will be
No Comments