Ensures that n lies in the range min..max, where min and max are modularly-equivalent (that is, n wraps around).