Defining random variables

You can define random variables by specifying either:

To create random variables with Value Lists:

You can create random numeric and text (string) variables with Value Lists in the variable definitions table.  

  1. In the Item Editor, click add varDefinition in the variable table.



  1. In the Variable column, enter a unique, logical variable name.
  2. In the Type column, click add @varType and select either numeric or string.

  1. In the Min/Max/Step OR ValueList column, click add valueList.
  2. Enter a numeric ID.

Each ID should be unique, unless you want to associate two or more related Value Lists.

  1. Click after Value: and enter a text value to display.
  2. Press the Tab key to enter additional values that will randomly display for a specific iteration of the item.
  3. [Optional] To add another value list (either text or numeric), right-click a Value List row and select either Insert before > varDefinition > varDefinition or Insert after > varDefinition > varDefinition.

Note: If you create a numeric variable, you can specify units, a conversion factor, LaTeX, and format options in the fourth column, even if you use a Value List instead of Min/Max/Step.

To create random variables with Min/Max/Step (numeric only):

You can create random numeric and text (string) variables in the variable definitions table.  

  1. In the Item Editor, click add varDefinition in the variable table.



  1. In the Variable column, enter a unique, logical variable name.
  2. In the Type column, click add @varType and select either numeric.

  1. Enter the minimum and maximum values for this variable by clicking add @minValue and add @maxValue.
  2. Enter the increment between values that display by clicking add @valueStep.

To define a constant, make the minimum and maximum the same value, and set step to 0.

  1. [Optional] Define units, conversion, LaTeX, and format information by clicking the pertinent add @ link in the last column:

Units – The units for this value, using TeX coding (i.e. "\frac{m}{s^2}"). You can control whether or not students see units (see Formatting variables). You don't need to add \rm when defining units; the system adds this by default.

Units conversion – Formula for converting this value to some other system of units as part of an answer. You must use this text field whenever you have a variable that requires a unit change. A common conversion is from degrees to radians.

For example, the Mastering system is designed so that the argument of all trigonometric functions is given in radians, not degrees. Therefore, if you define an angle "theta" in degrees, and an answer later in the item is "sin(theta)", you must provide the conversion "theta*pi/180" with add @unitsConversion.

LaTeX – Expression that overrides the default variable appearance.

Format – See Display of numeric variable values.

 

See also: 

Random variables overview

Defining randomized variables with other variables

Formatting variables