clamp

open fun clamp(value: Double, min: Double, max: Double): Double
open fun clamp(value: Float, min: Float, max: Float): Float

Test a value in specified range, returning minimum if it's below, and maximum if it's above

Return

value if it's between min and max, min if it's below, max if it's above

Parameters

value

Value to test

min

Minimum value of range

max

Maximum value of range