Files
rr3-apk/decompiled/sources/kotlin/random/RandomKt.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

43 lines
1.6 KiB
Java

package kotlin.random;
import kotlin.jvm.internal.Intrinsics;
import kotlin.ranges.IntRange;
/* loaded from: classes5.dex */
public abstract class RandomKt {
public static final int takeUpperBits(int i, int i2) {
return (i >>> (32 - i2)) & ((-i2) >> 31);
}
public static final int nextInt(Random random, IntRange range) {
Intrinsics.checkNotNullParameter(random, "<this>");
Intrinsics.checkNotNullParameter(range, "range");
if (!range.isEmpty()) {
return range.getLast() < Integer.MAX_VALUE ? random.nextInt(range.getFirst(), range.getLast() + 1) : range.getFirst() > Integer.MIN_VALUE ? random.nextInt(range.getFirst() - 1, range.getLast()) + 1 : random.nextInt();
}
throw new IllegalArgumentException("Cannot get random in empty range: " + range);
}
public static final int fastLog2(int i) {
return 31 - Integer.numberOfLeadingZeros(i);
}
public static final void checkRangeBounds(int i, int i2) {
if (i2 <= i) {
throw new IllegalArgumentException(boundsErrorMessage(Integer.valueOf(i), Integer.valueOf(i2)).toString());
}
}
public static final void checkRangeBounds(long j, long j2) {
if (j2 <= j) {
throw new IllegalArgumentException(boundsErrorMessage(Long.valueOf(j), Long.valueOf(j2)).toString());
}
}
public static final String boundsErrorMessage(Object from, Object until) {
Intrinsics.checkNotNullParameter(from, "from");
Intrinsics.checkNotNullParameter(until, "until");
return "Random range is empty: [" + from + ", " + until + ").";
}
}