# How to use Random Variables

<< All Articles | Print

Introduction

Learn and master the basics and advanced concepts of random variables, including defining and using restrictions within the editor. To use random variables, you need to ensure that the "Advanced" option is selected for variable options within the game properties page.

Step One: Understanding Diceâ€‹

The very first thing you need to know when working with random variables is that you need to understand the "Dice" concept. The "Dice" concept is simple, 1D2 can be used as an example of defining a random variable. The "1" in 1D2 represents how many dice are thrown. The "2" in 1D2 represents how many sides there are on the dice. This means 1 dice of 2 sides on each dice. This means a number generated can be 1 or 2. 1D6 would represent the throw of one standard six-sided dice.

Another example, please note this explanation can be complicated but if understood, can provide an easier way of understanding multiple dice: 3D100: this means there are three dice of 100 sides each. A number can be generated anywhere from 3 to 300. To make it more simple when using the multiple dice, think of how it would generate a number if there were 1 die. 1D100 it would mean the number is from 1 - 100, the lowest is 1 and the highest is 100. Do that two more times since there are three dice to get three sets of 1-100, 1-100, 1-100. Add the each side up, 1+1+1 = 3, 100+100+100 = 300, the least amount in 3D100 is 3, the greatest amount is 300.

Step Two: Defining a Random Variableâ€‹

At this point, you know the first half of defining a random variable. The second half deals with how it is defined. You define random variables in the variable enhancements menu which can be found by clicking the Variables button next to a link, which looks like a cross with a line under it. The menu gives a list of variables, a drop down menu, and a text input box. You cannot just type 1D100 in the input box, you need to define a function for how the variable is defined. This is where the drop down menu comes into play. You have: addition, subtraction, multiplication, division and many others.

If you just want a random number from 1-100 (1D100), use the "reset" function. This will be the highest used function in random variables. If you already have a number defined in a variable, use the add/subtract/multiply/divide function. These 4 functions are self-explanatory.

Sâ€‹tep Three: Using Random Variables

At this point you know everything on defining random variables. But now you need to know how to use them properly in a game. Random variables do not need to be just used in small parts of games where there is a card game, they can be used to help the author carry the game along. For example, a player could be progressing well and a SKILL variable records that, then he must scale a tall cliff, using a random variable you can manipulate how successful the player is in conjunction with the SKILL variable. So if his SKILL variable is low, the chances of success are slim whereas if his SKILL variable is high, the chances of success are high.