Numbers & Text > Math


Arithmetic

Add / Subtract / Multiply / Divide

arithmetic-block

Adds/Subtracts/Multiplies/Divides the two provided numbers. Note that only Chuck Norris can divide by 0.

([NUMBER] + [NUMBER])
([NUMBER] - [NUMBER])
([NUMBER] * [NUMBER])
([NUMBER] / [NUMBER])

Negate

negate number

Flips the sign of the given number.

-([NUMBER])

Remainder (Modulo)

remainder of number / number

Returns the integer remainder after dividing the first number by the second.

([NUMBER] % [NUMBER])

Random Numbers

Random Integer

random integer between int and int

Returns a random integer between the first and second numbers, inclusive. Provide integers for both numbers.

randomInt([INT], [INT])

Random Float Between Numbers

random float between number and number

Returns random floating point number between the first number (inclusive) and the second number (exclusive).

randomFloatBetween([NUMBER], [NUMBER])

Random Float Between Zero and One

random float between 0.0 and 1.0

Returns a random floating point number between 0 and 1, inclusive.

randomFloat()

Increment / Decrement

Increment / Decrement Number

increment dropdown by number

Adds (or subtracts) the given number to/from a number attribute.

[ATTRIBUTE] += [NUMBER];
[ATTRIBUTE] -= [NUMBER];

Operations

Absolute Value

absolute value of number

Returns the absolute value of the given number. (If it is negative, makes it positive.)

Math.abs([NUMBER])

Smaller / Larger of Two Numbers

smaller-block larger-block

Returns the smaller (or larger) of the two numbers.

Math.min([NUMBER], [NUMBER])
Math.max([NUMBER], [NUMBER])

Round / Floor / Ceiling

round number

Returns the nunber as an integer, with rounding applied as follows:

Round - Rounds up if the fractional part is 0.5 or more. Otherwise, rounds down.

Floor - Always rounds down.

Ceiling - Always rounds up.

Math.round([NUMBER])
Math.floor([NUMBER])
Math.ceil([NUMBER])

Conversion

Number Conversion

object as number

Converts the given value (can be any type) to a number. In practice, this is mainly useful for text and booleans (where true = 1, false = 0).

asNumber([VALUE])