I have a method that receives two range endpoints - start of range and end of range and an integer.
It checks to see if the integer falls between the two end points and returns either the integer or the corresponding end point if the integer falls outside the boundary.
Example 1:
Example 2:
Example 3:
Question: What should I call a method that does that? I had called it IntWithinRange, but I don't think I like that.
Any ideas?
How about ConstrictToRange
/ LimitToRange
/ ConfineToRange
? Something of this form would be seem to convey the meaning quite succinctly.
I've seen it called Clamp().
And that's what M$ calls it.
http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.mathhelper.clamp.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With