Site MapHelpFeedbackUsing Random Variables
Using Random Variables

You can use random variables in any test question. Random variables use an algorithm to create a new value for the variable each time the question is used. In other words, each time you generate the test, a new value is assigned to the variable in the question.

Create the Question

  1. In the Question field, enter the test question. The variable must be in square brackets [ ].

    For Example: Which of the following satisfies the equation, x + [y] = 14?

    If you embed a calculation in the question or answer, enclose it in double curly braces: {{ }}. Multiplication must be explicit. For example, you must type 2*sin(x) instead of 2sin(x).

    Be careful not to enter non-calculated answers that could be produced by calculated answers. In this example, any integer from 5 to 13 could be the correct answer generated by the random variable, so no integer in this range should be entered as a non-calculated answer choice.
  2. Next, enter the possible answers to solve the equation.
    <a onClick="window.open('/olcweb/cgi/pluginpop.cgi?it=gif::::/sites/dl/free/0000065899/576807/RandVarMultChoiceAnswers.gif','popWin', 'width=NaN,height=NaN,resizable,scrollbars');" href="#"><img valign="absmiddle" height="16" width="16" border="0" src="/olcweb/styles/shared/linkicons/image.gif"> (16.0K)</a>

  3. Select the correct answer from the Answer is choice dropdown box in the top right of the screen.

Define the Variables

Connect recognizes common operators. The list of supported functions that you can use in the question and answer field to reference random variables is provided in the Random Variables Help screen.

Scroll down below the question editing area and click the New Variable button to open the Random Variable Editing window.

  1. Select the variable type.

    Select local to apply the variable only to this question.
    Select global to make the variable available to all questions on this test.
    Select calculation if you are creating a calculated variable.

 

  1. Enter the name for the variable. This variable must match the variable name used in the question. For this example, the variable name is y.
  2. Enter the variable range and increments. You can use both real numbers and integers.
    <a onClick="window.open('/olcweb/cgi/pluginpop.cgi?it=gif::::/sites/dl/free/0000065899/576807/RandVarCreateNewExample.gif','popWin', 'width=NaN,height=NaN,resizable,scrollbars');" href="#"><img valign="absmiddle" height="16" width="16" border="0" src="/olcweb/styles/shared/linkicons/image.gif"> (4.0K)</a>
    You can also generate random variables from a pool. In this case, enter the numbers, letters, or word phrases in the chosen from box. Separate each variable with a comma.

    For Calculated Random Variables, see the next section.
  3. Click Create. The variable and its specifications appear in the Current Local Variables list.

  4. To save your work and preview the variable in the question, close the New Variable Editing window and click Preview in the Question Editing Navigation Bar.

Question Generation 1
<a onClick="window.open('/olcweb/cgi/pluginpop.cgi?it=gif::::/sites/dl/free/0000065899/576807/RandVarGenerateQsample1.gif','popWin', 'width=NaN,height=NaN,resizable,scrollbars');" href="#"><img valign="absmiddle" height="16" width="16" border="0" src="/olcweb/styles/shared/linkicons/image.gif"> (5.0K)</a>

Click Refresh to have the question load another random y variable.

A new value is assigned each time the question is generated.

To remove the variable from the test, click the delete variable icon on the line next to the variable. A dialogue box will open, prompting you to confirm your action.

Calculated Random Variables

You can also create calculated random variables and include conditions that must be met for the calculation to be applied. For the above example, we have a random variable y that ranges from 1 to 9. You could create a new calculated variable b equal to [y]+1. Then b would have a range from 2 to 10. Do this by…

  1. Creating the local variable y as shown previously.
  2. Create a new variable and select Calculation from the Type dropdown box.
  3. Enter b as the variable name.
  4. Enter [y] + 1 in the calculated text entry box.
  5. Click Create.

Conditions

Conditions are logical expressions that are evaluated when a variable is tested. The variable being tested will only be generated when the conditions you have entered are met.
For example, if we have a variable c that ranges from 2 to 10 in increments of 1, it is possible to put in a condition such as [c] != 5 which would create a calculated value for c in the range from 2 to 10 EXCEPT when c equals 5. Thus the range would run from 2 to 4 and from 6 to 10.

Note: you can add more than one condition by entering each on a line by itself. All of the conditions entered must be met for the variable to be generated.

Sample

The Sample area at the bottom of the Random Variable window allows you to test the variable output by clicking the Again button. Each time the Again button is pressed, the variable is calculated and the value updated. This is useful when you are creating calculated variables or variables with conditions and want to preview or sample the output.

Update the Variables

Once you have created a variable, you can only update fields related to the variable type you originally created. For example if you created a Local variable with a range from 1 to 100 in increments of 10, you can only update values in the range fields. Entering values into the Chosen from: or Calculated: fields will not be saved. The same would hold true for any “pooled” or “calculated” variables. Entering values in fields other than those directly related to the variable’s original setup type will not be saved. To change a variable's type, you must first delete it from the random variable's list and recreate it. When you recreate it, select the type you want.

To change the variables range, pool or calculated values, click the variable name to access the Random Variable Editing window. In the Random Variable Editing window make your changes and click the Update button.

To remove a variable from the test, click the appropriate Delete button.








Connect Online HelpOnline Learning Center

Home > Question Types > Using Random Variables