Throw NegativeRangeException when range is negative

Negative ranges would cause an infinite loop and eventually crash.