Skip to content

Expression Functions

This page defines all of the built-in functions added to expr-eval.

Returns true with the provided probability, false otherwise.

  • chance: Probability between 0 and 1.

Gets the environment variable with the provided name. It will attempt to parse booleans and numbers. For booleans, it must be the string true and false.

  • name: The environment variable name.

Produces a random number with a normal distribution.

  • mean: The mean. Defaults to 0.
  • stdDev: The standard deviation. Defaults to 1.

Adds or subtracts a random “jitter” [-amt, amt) to the provided value.

  • value: The initial value.
  • amt: The max amount of jitter to add or subtract.

Converts the provided minutes into milliseconds.

  • n: The number of minutes.

Picks a random element from the provided array with equal probability.

  • l: The array.

Converts the provided seconds into milliseconds.

  • n: The number of seconds.