To mitigate negative numbers you need to add the length of the array:

`i = ((i - 1) + 4) mod 4`

leaving you with:

`i = (i + 3) mod 4`

Reply via email to