clamp

fun Int.clamp(min: Int, max: Int): Int
fun Long.clamp(min: Long, max: Long): Long
fun Double.clamp(min: Double, max: Double): Double
fun Float.clamp(min: Float, max: Float): Float

Clamps this value into the range min and max