# Engine.Random

The Random library provides several functions to pick random numbers or items.
Engine.Random.Number(min, max, precision)
Selects a random number between `min` and `max`, excluding `max` itself.

min
  The minimum number. Defaults to 0.

max
  The maximum number (itself excluded). Defaults to 1.

precision
  The precision; this is what the result will be rounded to. Defaults to 0.00000001.

Example: Get a whole number from 0 to 9
<h7>Code:</h7>

    Engine.Random.Number(0, 10, 1);

<h7>Output:</h7>

    7

Example: Get a one-tenth-precision number from 0 to 9.9
<h7>Code:</h7>

    Engine.Random.Number(0, 10, 0.1);

<h7>Output:</h7>

    3.7

Example: Get a one-fifth-precision number from 5 to 9.8:
<h7>Code:</h7>

    Engine.Random.Number(5, 10, 0.2);

<h7>Output:</h7>

    6.4

Engine.Random.Choose(item [, item [, item ...]])
Engine.Random.Choose(itemarray)
Selects a random item from the supplied items.

item
  An item to choose from.

itemarray
  An array of items to choose from.

Example: Select a random color from a list using multiple arguments
<h7>Code:</h7>

    Engine.Random.Choose("blue", "green", "red", "yellow");

<h7>Output:</h7>

    "green"

Example: Select a random day from a list using an array
<h7>Code:</h7>

    var days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
    Engine.Random.Choose(days);

<h7>Output:</h7>

    "Thursday"

Engine.Random.Pick(amount, item [, item [, item ...]])
Engine.Random.Pick(amount, itemarray)
Selects amount unique random items from the supplied items. Each item can only appear in the result once.
Important: The amount argument must always be equal to or higher than the amount of supplied items!

amount
  The amount of items to select.

item
  An item to choose from.

itemarray
  An array of items to choose from.

Example: Select three random colors from a list using multiple arguments
<h7>Code:</h7>

    Engine.Random.Pick(3, "red", "green", "blue", "yellow", "purple", "brown", "black", "white", "orange");

<h7>Output:</h7>

    ["blue", "orange", "red"]

Example: Select two vegetables from a list using an array
<h7>Code:</h7>

    var vegetables = ["celery", "potato", "tomato", "coleslaw", "onion"];
    Engine.Random.Pick(2, vegetables);

<h7>Output:</h7>

    ["tomato", "onion"]