Bug! Should be: min + (pass1 + pass2 + pass3) % (max - min + 1)