| 1 | export function gcd(a: number, b: number): number { |
| 2 | while (b !== 0) [a, b] = [b, a % b]; |
| 3 | return a; |
| 4 | } |
| 5 | |
| 6 | export function clamp(value: number, min: number, max: number): number { |
| 7 | return Math.min(max, Math.max(min, value)); |
| 8 | } |