152 lines
4.7 KiB
Java
152 lines
4.7 KiB
Java
package d0.c0;
|
|
|
|
import d0.x.b;
|
|
import d0.z.d.m;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
/* compiled from: Random.kt */
|
|
public abstract class c {
|
|
public static final c a = b.a.defaultPlatformRandom();
|
|
public static final a b = new a(null);
|
|
|
|
/* compiled from: Random.kt */
|
|
public static final class a extends c {
|
|
public a(DefaultConstructorMarker defaultConstructorMarker) {
|
|
}
|
|
|
|
@Override // d0.c0.c
|
|
public int nextBits(int i) {
|
|
return c.access$getDefaultRandom$cp().nextBits(i);
|
|
}
|
|
|
|
@Override // d0.c0.c
|
|
public byte[] nextBytes(int i) {
|
|
return c.access$getDefaultRandom$cp().nextBytes(i);
|
|
}
|
|
|
|
@Override // d0.c0.c
|
|
public byte[] nextBytes(byte[] bArr) {
|
|
m.checkNotNullParameter(bArr, "array");
|
|
return c.access$getDefaultRandom$cp().nextBytes(bArr);
|
|
}
|
|
|
|
@Override // d0.c0.c
|
|
public byte[] nextBytes(byte[] bArr, int i, int i2) {
|
|
m.checkNotNullParameter(bArr, "array");
|
|
return c.access$getDefaultRandom$cp().nextBytes(bArr, i, i2);
|
|
}
|
|
|
|
@Override // d0.c0.c
|
|
public int nextInt() {
|
|
return c.access$getDefaultRandom$cp().nextInt();
|
|
}
|
|
|
|
@Override // d0.c0.c
|
|
public int nextInt(int i) {
|
|
return c.access$getDefaultRandom$cp().nextInt(i);
|
|
}
|
|
|
|
@Override // d0.c0.c
|
|
public int nextInt(int i, int i2) {
|
|
return c.access$getDefaultRandom$cp().nextInt(i, i2);
|
|
}
|
|
|
|
@Override // d0.c0.c
|
|
public long nextLong() {
|
|
return c.access$getDefaultRandom$cp().nextLong();
|
|
}
|
|
}
|
|
|
|
public static final /* synthetic */ c access$getDefaultRandom$cp() {
|
|
return a;
|
|
}
|
|
|
|
public abstract int nextBits(int i);
|
|
|
|
public byte[] nextBytes(int i) {
|
|
return nextBytes(new byte[i]);
|
|
}
|
|
|
|
public byte[] nextBytes(byte[] bArr) {
|
|
m.checkNotNullParameter(bArr, "array");
|
|
return nextBytes(bArr, 0, bArr.length);
|
|
}
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:10:0x001a */
|
|
/* JADX WARNING: Removed duplicated region for block: B:22:0x0070 */
|
|
public byte[] nextBytes(byte[] bArr, int i, int i2) {
|
|
boolean z2;
|
|
m.checkNotNullParameter(bArr, "array");
|
|
int length = bArr.length;
|
|
boolean z3 = true;
|
|
if (i >= 0 && length >= i) {
|
|
int length2 = bArr.length;
|
|
if (i2 >= 0 && length2 >= i2) {
|
|
z2 = true;
|
|
if (!z2) {
|
|
if (i > i2) {
|
|
z3 = false;
|
|
}
|
|
if (z3) {
|
|
int i3 = (i2 - i) / 4;
|
|
for (int i4 = 0; i4 < i3; i4++) {
|
|
int nextInt = nextInt();
|
|
bArr[i] = (byte) nextInt;
|
|
bArr[i + 1] = (byte) (nextInt >>> 8);
|
|
bArr[i + 2] = (byte) (nextInt >>> 16);
|
|
bArr[i + 3] = (byte) (nextInt >>> 24);
|
|
i += 4;
|
|
}
|
|
int i5 = i2 - i;
|
|
int nextBits = nextBits(i5 * 8);
|
|
for (int i6 = 0; i6 < i5; i6++) {
|
|
bArr[i + i6] = (byte) (nextBits >>> (i6 * 8));
|
|
}
|
|
return bArr;
|
|
}
|
|
throw new IllegalArgumentException(c.d.b.a.a.p("fromIndex (", i, ") must be not greater than toIndex (", i2, ").").toString());
|
|
}
|
|
throw new IllegalArgumentException(c.d.b.a.a.y(c.d.b.a.a.N("fromIndex (", i, ") or toIndex (", i2, ") are out of range: 0.."), bArr.length, '.').toString());
|
|
}
|
|
}
|
|
z2 = false;
|
|
if (!z2) {
|
|
}
|
|
}
|
|
|
|
public abstract int nextInt();
|
|
|
|
public int nextInt(int i) {
|
|
return nextInt(0, i);
|
|
}
|
|
|
|
public int nextInt(int i, int i2) {
|
|
int i3;
|
|
int nextInt;
|
|
int i4;
|
|
d.checkRangeBounds(i, i2);
|
|
int i5 = i2 - i;
|
|
if (i5 > 0 || i5 == Integer.MIN_VALUE) {
|
|
if (((-i5) & i5) == i5) {
|
|
i3 = nextBits(d.fastLog2(i5));
|
|
} else {
|
|
do {
|
|
nextInt = nextInt() >>> 1;
|
|
i4 = nextInt % i5;
|
|
} while ((i5 - 1) + (nextInt - i4) < 0);
|
|
i3 = i4;
|
|
}
|
|
return i + i3;
|
|
}
|
|
while (true) {
|
|
int nextInt2 = nextInt();
|
|
if (i <= nextInt2 && i2 > nextInt2) {
|
|
return nextInt2;
|
|
}
|
|
}
|
|
}
|
|
|
|
public long nextLong() {
|
|
return (((long) nextInt()) << 32) + ((long) nextInt());
|
|
}
|
|
}
|