Dragos Rachieru
06/08/2022, 9:08 AMX or min or max, like:
X=50,min=0,max=40 , then the result is 40
I need this to calculate some positions, don't know if there's a method using IntRangeRobert Williams
06/08/2022, 9:14 AMRandom.nextInt can take a (min,max) or an IntRangeSam
06/08/2022, 9:14 AMcoerceIn?
Return this value if it's in the range, orhttps://kotlinlang.org/api/latest/jvm/stdlib/kotlin.ranges/coerce-in.htmlif this value is less thanrange.start, orrange.startif this value is greater thanrange.endInclusive.range.endInclusive
Robert Williams
06/08/2022, 9:15 AMX in your example 🤔Robert Williams
06/08/2022, 9:17 AMcoerceIn makes more sense, not sure where I got the idea you wanted a random value homer disappearDragos Rachieru
06/08/2022, 9:24 AMcoerceIn is the extension I was looking for