// http://stackoverflow.com/questions/4467539/javascript-modulo-not-behaving export function modulo(i, n) { return ((i % n) + n) % n; }