clamp

fun clamp(value: Int, min: Int, max: Int): Int(source)

Returns value constrained to the inclusive range from min to max.