This implementation assumes that theIndexvalue is never going to exceed twice the Range value. This way we can avoid the modulo operator or a power of 2 range value requirement and have an efficient wrap around function.