Math functions
Functions related to math
- Source:
math.utils.ts
clamp(value, min, max)
Clamp a value between a min and a max value
Parameters
- value
- Type:
number
- Type:
- min
- Type:
number
- Type:
- max
- Type:
number
- Type:
Returns
- Type:
number
randomRange(min, max)
Get a random number in a range between a min and a max value
Parameters
- min
- Type:
number
- Type:
- max
- Type:
number
- Type:
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
- Type:
- precision - Maximum amount of digits allowed after the comma
- Type:
number
- Type:
Returns
Rounded value
- Type:
number