Random Action

image\Action_Variable_Random.jpg

The Random action allows you to create a randomly generated number that you can store in a variable. There are often times when creating interactive publications when you might want to create a random number, perhaps to ensure that a test paper is chose randomly or to simulate a dice in a game.

Setting up the Random action:

  1. Add the Random action to your trigger, as described in adding actions. The Random tab will automatically appear when you add the action.

  2. Use the Variable option of the Destination panel to select the variable from the current publication in which the randomly generated number will be stored. Click on the down arrow to the right of the Variable box to list all of the variables in the current publication. Alternative, click on the Create New Variable… button to open the New Variable dialog box in which you can create a new variable.

  3. Use the Number option if you want to type in the maximum number that can be generated.

Note:
You must decide on the range for the random number by specifying a maximum number – the range always starts at one. For example, if you type the number 64 in the Number box, the random number will be anything from 1 to 64 inclusive.

  1. Use the Variable option if you want to use the value of a variable as the maximum number that can be generated.

Note:
The value of the variable must be a number.

  1. Click on the Apply button to save your changes.

The random number generated when the trigger is activated may appear several times while other numbers may not. For example, if the range is 1 to 6 (like the faces of a dice) and you activate the action 10 times, the number 3 may appear several times while the number 1 may not appear at all.

If you want to randomly generate which page appears on screen, use the special preset options<Random> and <Next Random> in of the Go to Page action – see Go to Page action for more information.

Related Topics:

Introducing the Variables Actions

Choosing an Action