Math

random()#

Returns a random 32-bit integer.

abs(value)#

Returns the absolute value of the given number.

sq(value)#

sqrt(value)#

Calculates the square of a value and the square root of a value.

log(value)#

Calculates the natural logarithm of the given value.

cos(value)#

sin(value)#

tan(value)#

Computes the trigonometric cosine, sine or tangent of the given angle in radians.

max(a,b)#

min(a,b)#

Returns the minimum or the maximum out of the given values.

constrain(value, min, max)#

Constrains the value so it’s always within the min-max range.

map(value, fromLow, fromHigh, toLow, toHigh)#

Re-maps a number from one range to another. That is, a value of fromLow would get mapped to toLow, a value of fromHigh to toHigh, values in-between to values in-between, etc.

round(value)#

floor(value)#

ceil(value)#

Rounds the given number to the closest integer.

The floor function rounds it always down while ceil rounds it always up.