Wrap a number into [0, modValue), so negative inputs come back positive — unlike the %
operator, which keeps the sign of its left operand. Use it to cycle an index around a list.
Throws
If modValue is 0, since no value can be wrapped into an empty range. Guard the
call when the modulus comes from a length that may be zero.
mod