package kotlin.ranges; import java.util.NoSuchElementException; import kotlin.jvm.internal.Intrinsics; import kotlin.random.Random; import kotlin.random.RandomKt; /* loaded from: classes5.dex */ public abstract class RangesKt___RangesKt extends RangesKt__RangesKt { public static int coerceAtLeast(int i, int i2) { return i < i2 ? i2 : i; } public static long coerceAtLeast(long j, long j2) { return j < j2 ? j2 : j; } public static int coerceAtMost(int i, int i2) { return i > i2 ? i2 : i; } public static long coerceAtMost(long j, long j2) { return j > j2 ? j2 : j; } public static int random(IntRange intRange, Random random) { Intrinsics.checkNotNullParameter(intRange, ""); Intrinsics.checkNotNullParameter(random, "random"); try { return RandomKt.nextInt(random, intRange); } catch (IllegalArgumentException e) { throw new NoSuchElementException(e.getMessage()); } } public static IntProgression downTo(int i, int i2) { return IntProgression.Companion.fromClosedRange(i, i2, -1); } public static IntRange until(int i, int i2) { if (i2 <= Integer.MIN_VALUE) { return IntRange.Companion.getEMPTY(); } return new IntRange(i, i2 - 1); } public static int coerceIn(int i, int i2, int i3) { if (i2 <= i3) { return i < i2 ? i2 : i > i3 ? i3 : i; } throw new IllegalArgumentException("Cannot coerce value to an empty range: maximum " + i3 + " is less than minimum " + i2 + '.'); } public static long coerceIn(long j, long j2, long j3) { if (j2 <= j3) { return j < j2 ? j2 : j > j3 ? j3 : j; } throw new IllegalArgumentException("Cannot coerce value to an empty range: maximum " + j3 + " is less than minimum " + j2 + '.'); } }