-
MathType
-
Wiris Quizzes
-
Learning Lemur
-
CalcMe
-
MathPlayer
-
Store FAQ
-
VPAT for the electronic documentation
-
MathFlow
-
BF FAQ
Randomness
Reading time: 1minNota
As you may use these commands to generate an algorithm for a WirisQuizzes question, we show how to create them through the sheet and using the code editor. You can see more details about it here.
The random function in CalcMe is adaptable to many cases of use. For example, you will see how to remove the "0" from a random selection. The normal command would be like:
CalcMe sheet | CalcMe code editor |
---|---|
![]() |
![]() |
By default, this includes all of the numbers between -10 and 10. If given the requirements of the question, the number 0 needs to be excluded from the set, you can remove it with one simple instruction:
CalcMe sheet | CalcMe code editor |
---|---|
![]() |
![]() |
You have to add brackets around the first list for this to work. This can, of course, work equally for any other number you need to exclude other than zero:
CalcMe sheet | CalcMe code editor |
---|---|
![]() |
![]() |
The above would produce a random number between -10 and 10, except the number 8. You can even do this with more than one number:
CalcMe sheet | CalcMe code editor |
---|---|
![]() |
![]() |
This would remove 8,-8, and 0 from the selection. As you can see, there are many more options when creating a random variable. So far, you have retrieved integer numbers, but you can also work with real numbers.
CalcMe sheet | CalcMe code editor |
---|---|
![]() |
![]() |
As a general rule, these real numbers will have as many decimal or significant figures as defined in the Application settings. You can adjust it by defining the step between the possible random values.
CalcMe sheet | CalcMe code editor |
---|---|
![]() |
![]() |
CalcMe sheet | CalcMe code editor |
![]() |
![]() |
Atenció
As you may have seen, we can use {}
and []
to exclude several numbers for the set of possible values when generating random variables. We use each of them as follows:
[]
define arrays and matrices (arrays are supposed to contain the same data types).
{}
define lists (lists can have different data types).
The random function can exclude values as long as the two parameters you pass are in the same format. In other words, if you include a list as a first parameter, you should pass a list as the second parameter as well.