Static Readonly RandomThe range of numbers from which to generate a random integer.
A random integer within the specified range.
const result = MathUtils.random({ min: 0, max: 10 });
console.log(result); // Output: Random integer between 0 and 9
Static absThe static abs function in TypeScript returns the absolute value of a given number.
The parameter x is a number that represents the value for which you want to
calculate the absolute value.
The absolute value of the input number x is being returned.
const result = MathUtils.abs(-7);
console.log(result); // Output: 7
Static calcThis TypeScript function calculates the hypotenuse of a right triangle given the lengths of its two shorter sides.
The parameter a represents the length of one side of a right triangle.
The parameter b represents the length of one of the sides of a right
triangle.
The function calcHypotenuse is returning the square root of the sum of the squares of
the two input numbers a and b.
const result = MathUtils.calcHypotenuse(7,24);
console.log(result); // Output: 25
Static powerThe function pow calculates the power of a base number raised to an exponent using the
Math.pow method.
The base parameter represents the base number in a power operation. It is
/** The static power function in TypeScript calculates the result of raising a base number to a specified exponent.
The exponent parameter in the power function represents the power to which the base number is raised. It determines how many times the base number is multiplied by itself.
The power function is returning the result of raising the base to the power of
exponent using Math.pow method.
const result = MathUtils.power(2,2);
console.log(result); // Output: 4
Static sqrtThe static sqrt function in TypeScript calculates the square root of a given number.
The parameter x represents the number for which you want to calculate the
square root.
The square root of the input number x is being returned.
const result = MathUtils.sqrt(9);
console.log(result); // Output: 3
Generated using TypeDoc
Generates a random integer within the specified range.