Function isValueInRange

Checks if a value is within a range [min, max].