mutate array in-place to get the modulo when divided by scalar value
note that this is slightly different from the remainder rem operator, as this always returns a positive number