Skip to content

Math functions

Functions related to math

clamp(value, min, max)

Clamp a value between a min and a max value

Parameters

  • value
    • Type: number
  • min
    • Type: number
  • max
    • Type: number

Returns

  • Type: number

randomRange(min, max)

Get a random number in a range between a min and a max value

Parameters

  • min
    • Type: number
  • max
    • Type: number

Returns

  • Type: number

round(value, precision)

Round a number off to a certain amount of digits after the comma

Parameters

  • value - Initial value
    • Type: number
  • precision - Maximum amount of digits allowed after the comma
    • Type: number

Returns

Rounded value

  • Type: number

Built by Prozilla