Picking and Sorting Variables: max, min, randwrong, randwrong!, randvar, randvar!, sortup, sortdown

max()

To take the max of a list of variables. 

Example

max.jpg

min()

To take the minimum of a list of variables. 

Example

min.jpg

 
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

randw.jpg

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.

qute8.jpg

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.

ans1.jpg

So in the preview the question and the right and wrong answers to it will look in the following way.

randw6.jpgrandw7.jpg

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.

ans2.jpgrandw12.jpg

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

randw1.jpg

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.

ans3.jpgans4.jpgrandw14.jpg

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.

ans5.jpgans4.jpg

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.

randw19.jpgrandw18.jpgrandw17.jpgrandw16.jpg

 

randvar()

Chooses randomly a variable from a list. 

Example

randv.jpg

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.

qute9.jpg

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.

rvr2.jpgrvr3.jpg

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

randv1.jpg

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

randv1.jpg

Practical example

Let’s review an example of range usage in question writing. The question is the following.

qute10.jpg

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).

qute11.jpg

So the output will look as follows.

sortup2.jpg

And the correct answer calculated with the help of the function we established will be

sortup3.jpg

sortdown()

Gives the n value from biggest to smallest. sortdown is equivalent to max.

Example

srtd.jpg

Practical example

Let’s review an example of range usage in question writing. The question is the following

qute12.jpg

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).

qute13.jpg

So the output will look as follows.

sortdown2.jpg

And the correct answer calculated with the help of the function we established will be

sortdown3.jpg