import type { Range } from './types' /** * Modulo N to a range of 0 to M-1 */ export function mod(n: number, bound: T): Range { return (n + bound) % bound as Range }