This is a huge performance problem. iterations like this are trouble since you can easily compute the perturbation to bring your value into the range. Can you replace this iteration with a calculation instead? For instance, Wrap(123434343324, 1, 2) would iterate forever and make us all quite upset with your code. When you write the unit tests for these methods, you will need to include boundary tests like that.