export default class MathUtil { static add(a: number, b: number): number { return a + b; } static compare(a: number, b: number): number { return ( (a < b) ? -1 : (a == b) ? 0 : 1 ); } static floorMod(a: number, b: number): number { return ((a % b) + b) % b; } static rotate(array: any[], distance: number): void { while (distance-- > 0) { array.push(array.shift()); } } static clamp(min: number, max: number, value: number): number { if (max < min) { throw new Error("max should not be less than min"); } return Math.max(min, Math.min(max, value)); } }