Randomness

2 min read

Set up a randomness variable to use as a random number generator. In the editor, press the (x) button in the toolbar to open Diagram parameters, press New parameter and choose Randomness (“Sample from a range each Play”). You may choose between Interval (from/to) or Array (integer numbers divided by a comma) to select a random number.

Interval

The New parameter dialog with Randomness selected: Name, Type set to Interval, From and To boxes, Distribution (Uniform or Gaussian) and Update on (Each Play or Each Step).The New parameter dialog with Randomness selected: Name, Type set to Interval, From and To boxes, Distribution (Uniform or Gaussian) and Update on (Each Play or Each Step).

Name

Parameters (called Custom variables in older guides) are case sensitive. Use the name to reference it in the Formula fields of nodes and connections throughout your diagrams.

Here is an example.

The Properties panel of a Resource Connection with Type set to Formula and the parameter name loot_value typed in the formula box.The Properties panel of a Resource Connection with Type set to Formula and the parameter name loot_value typed in the formula box.
A parameter used in the formula of a Resource Connection

Type

Choose Interval from the drop-down if you want the random value to be generated from a fixed interval.

From/To

Use the From and To fields to define the minimum and maximum values of your interval. The interval is closed – it includes both its limit points. E.g. An interval defined as From: 20; To: 80 will generate a value x, where x is an integer greater than or equal to 20 and less than or equal to 80.

Distribution (of probabilities)

  • Gaussian – symmetric about the mean, where data near the mean are more frequent in occurrence than data far from the mean. It’s a function that represents the distribution of many random variables as a symmetrical bell-shaped graph. Read more
  • Uniform – all outcomes are equally likely. Read more

Update – when during a Play the value is generated.

  • Each Play – at the beginning of each Play. The value will be the same throughout the Play.
  • Each Step – the value will be randomly generated at the beginning of each Step of the Play.

Description – Describe the purpose or origin of the variable.

Array

The New parameter dialog with Randomness and the Array type: a name, a box with the values 10, 20, 30, 50, Distribution and Update on.The New parameter dialog with Randomness and the Array type: a name, a box with the values 10, 20, 30, 50, Distribution and Update on.

Name

Use the variable’s name to reference it in the Formula fields of nodes and connections throughout your diagrams.

Type

Choose Array from the drop-down if you want the random value picked up from a predefined array.

Array Values

Use this field to input the values of the array. You can only declare one-dimensional arrays in this dialogue.

Distribution (of probabilities)

  • Gaussian – symmetric about the mean, where data near the mean are more frequent in occurrence than data far from the mean. Read more
  • Uniform – all outcomes are equally likely. Read more

Update – when the value is generated.

  • Each Play – at the beginning of each Play. The value will be the same throughout the Play.
  • Each Step – the value will be randomly generated at the beginning of each Step.

Selected models to Play and remix: Selected reward system models.