ADD week 5
This commit is contained in:
@ -0,0 +1,53 @@
|
||||
package kotlin.random;
|
||||
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: PlatformRandom.kt */
|
||||
@Metadata(d1 = {"\u0000>\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0012\n\u0002\b\u0002\n\u0002\u0010\u0006\n\u0000\n\u0002\u0010\u0007\n\u0002\b\u0003\n\u0002\u0010\t\n\u0000\b \u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\bH\u0016J\b\u0010\n\u001a\u00020\u000bH\u0016J\u0010\u0010\f\u001a\u00020\r2\u0006\u0010\u000e\u001a\u00020\rH\u0016J\b\u0010\u000f\u001a\u00020\u0010H\u0016J\b\u0010\u0011\u001a\u00020\u0012H\u0016J\b\u0010\u0013\u001a\u00020\bH\u0016J\u0010\u0010\u0013\u001a\u00020\b2\u0006\u0010\u0014\u001a\u00020\bH\u0016J\b\u0010\u0015\u001a\u00020\u0016H\u0016R\u0012\u0010\u0003\u001a\u00020\u0004X¦\u0004¢\u0006\u0006\u001a\u0004\b\u0005\u0010\u0006¨\u0006\u0017"}, d2 = {"Lkotlin/random/AbstractPlatformRandom;", "Lkotlin/random/Random;", "()V", "impl", "Ljava/util/Random;", "getImpl", "()Ljava/util/Random;", "nextBits", "", "bitCount", "nextBoolean", "", "nextBytes", "", "array", "nextDouble", "", "nextFloat", "", "nextInt", "until", "nextLong", "", "kotlin-stdlib"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class AbstractPlatformRandom extends Random {
|
||||
public abstract java.util.Random getImpl();
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public int nextBits(int bitCount) {
|
||||
return RandomKt.takeUpperBits(getImpl().nextInt(), bitCount);
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public int nextInt() {
|
||||
return getImpl().nextInt();
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public int nextInt(int until) {
|
||||
return getImpl().nextInt(until);
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public long nextLong() {
|
||||
return getImpl().nextLong();
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public boolean nextBoolean() {
|
||||
return getImpl().nextBoolean();
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public double nextDouble() {
|
||||
return getImpl().nextDouble();
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public float nextFloat() {
|
||||
return getImpl().nextFloat();
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public byte[] nextBytes(byte[] array) {
|
||||
Intrinsics.checkNotNullParameter(array, "array");
|
||||
getImpl().nextBytes(array);
|
||||
return array;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package kotlin.random;
|
||||
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: PlatformRandom.kt */
|
||||
@Metadata(d1 = {"\u0000\u001b\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\b\u0003*\u0001\b\b\u0000\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002R\u0014\u0010\u0003\u001a\u00020\u00048VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0005\u0010\u0006R\u0010\u0010\u0007\u001a\u00020\bX\u0082\u0004¢\u0006\u0004\n\u0002\u0010\t¨\u0006\n"}, d2 = {"Lkotlin/random/FallbackThreadLocalRandom;", "Lkotlin/random/AbstractPlatformRandom;", "()V", "impl", "Ljava/util/Random;", "getImpl", "()Ljava/util/Random;", "implStorage", "kotlin/random/FallbackThreadLocalRandom$implStorage$1", "Lkotlin/random/FallbackThreadLocalRandom$implStorage$1;", "kotlin-stdlib"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class FallbackThreadLocalRandom extends AbstractPlatformRandom {
|
||||
private final FallbackThreadLocalRandom$implStorage$1 implStorage = new ThreadLocal<java.util.Random>() { // from class: kotlin.random.FallbackThreadLocalRandom$implStorage$1
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // java.lang.ThreadLocal
|
||||
public java.util.Random initialValue() {
|
||||
return new java.util.Random();
|
||||
}
|
||||
};
|
||||
|
||||
@Override // kotlin.random.AbstractPlatformRandom
|
||||
public java.util.Random getImpl() {
|
||||
java.util.Random random = get();
|
||||
Intrinsics.checkNotNullExpressionValue(random, "implStorage.get()");
|
||||
return random;
|
||||
}
|
||||
}
|
84
02-Easy5/E5/sources/kotlin/random/KotlinRandom.java
Normal file
84
02-Easy5/E5/sources/kotlin/random/KotlinRandom.java
Normal file
@ -0,0 +1,84 @@
|
||||
package kotlin.random;
|
||||
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.DefaultConstructorMarker;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: PlatformRandom.kt */
|
||||
@Metadata(d1 = {"\u0000B\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u0012\n\u0000\n\u0002\u0010\u0006\n\u0000\n\u0002\u0010\u0007\n\u0002\b\u0003\n\u0002\u0010\t\n\u0002\b\u0004\b\u0002\u0018\u0000 \u001b2\u00020\u0001:\u0001\u001bB\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\u0010\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\nH\u0014J\b\u0010\f\u001a\u00020\bH\u0016J\u0010\u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u0010H\u0016J\b\u0010\u0011\u001a\u00020\u0012H\u0016J\b\u0010\u0013\u001a\u00020\u0014H\u0016J\b\u0010\u0015\u001a\u00020\nH\u0016J\u0010\u0010\u0015\u001a\u00020\n2\u0006\u0010\u0016\u001a\u00020\nH\u0016J\b\u0010\u0017\u001a\u00020\u0018H\u0016J\u0010\u0010\u0019\u001a\u00020\u000e2\u0006\u0010\u001a\u001a\u00020\u0018H\u0016R\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0006R\u000e\u0010\u0007\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u001c"}, d2 = {"Lkotlin/random/KotlinRandom;", "Ljava/util/Random;", "impl", "Lkotlin/random/Random;", "(Lkotlin/random/Random;)V", "getImpl", "()Lkotlin/random/Random;", "seedInitialized", "", "next", "", "bits", "nextBoolean", "nextBytes", "", "bytes", "", "nextDouble", "", "nextFloat", "", "nextInt", "bound", "nextLong", "", "setSeed", "seed", "Companion", "kotlin-stdlib"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
final class KotlinRandom extends java.util.Random {
|
||||
private static final Companion Companion = new Companion(null);
|
||||
private static final long serialVersionUID = 0;
|
||||
private final Random impl;
|
||||
private boolean seedInitialized;
|
||||
|
||||
public final Random getImpl() {
|
||||
return this.impl;
|
||||
}
|
||||
|
||||
public KotlinRandom(Random impl) {
|
||||
Intrinsics.checkNotNullParameter(impl, "impl");
|
||||
this.impl = impl;
|
||||
}
|
||||
|
||||
@Override // java.util.Random
|
||||
protected int next(int bits) {
|
||||
return this.impl.nextBits(bits);
|
||||
}
|
||||
|
||||
@Override // java.util.Random
|
||||
public int nextInt() {
|
||||
return this.impl.nextInt();
|
||||
}
|
||||
|
||||
@Override // java.util.Random
|
||||
public int nextInt(int bound) {
|
||||
return this.impl.nextInt(bound);
|
||||
}
|
||||
|
||||
@Override // java.util.Random
|
||||
public boolean nextBoolean() {
|
||||
return this.impl.nextBoolean();
|
||||
}
|
||||
|
||||
@Override // java.util.Random
|
||||
public long nextLong() {
|
||||
return this.impl.nextLong();
|
||||
}
|
||||
|
||||
@Override // java.util.Random
|
||||
public float nextFloat() {
|
||||
return this.impl.nextFloat();
|
||||
}
|
||||
|
||||
@Override // java.util.Random
|
||||
public double nextDouble() {
|
||||
return this.impl.nextDouble();
|
||||
}
|
||||
|
||||
@Override // java.util.Random
|
||||
public void nextBytes(byte[] bytes) {
|
||||
Intrinsics.checkNotNullParameter(bytes, "bytes");
|
||||
this.impl.nextBytes(bytes);
|
||||
}
|
||||
|
||||
@Override // java.util.Random
|
||||
public void setSeed(long seed) {
|
||||
if (this.seedInitialized) {
|
||||
throw new UnsupportedOperationException("Setting seed is not supported.");
|
||||
}
|
||||
this.seedInitialized = true;
|
||||
}
|
||||
|
||||
/* compiled from: PlatformRandom.kt */
|
||||
@Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\b\u0082\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000¨\u0006\u0005"}, d2 = {"Lkotlin/random/KotlinRandom$Companion;", "", "()V", "serialVersionUID", "", "kotlin-stdlib"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
||||
private static final class Companion {
|
||||
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
||||
this();
|
||||
}
|
||||
|
||||
private Companion() {
|
||||
}
|
||||
}
|
||||
}
|
36
02-Easy5/E5/sources/kotlin/random/PlatformRandom.java
Normal file
36
02-Easy5/E5/sources/kotlin/random/PlatformRandom.java
Normal file
@ -0,0 +1,36 @@
|
||||
package kotlin.random;
|
||||
|
||||
import java.io.Serializable;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.DefaultConstructorMarker;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: PlatformRandom.kt */
|
||||
@Metadata(d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\b\u0002\u0018\u0000 \t2\u00020\u00012\u00060\u0002j\u0002`\u0003:\u0001\tB\r\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006R\u0014\u0010\u0004\u001a\u00020\u0005X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\b¨\u0006\n"}, d2 = {"Lkotlin/random/PlatformRandom;", "Lkotlin/random/AbstractPlatformRandom;", "Ljava/io/Serializable;", "Lkotlin/io/Serializable;", "impl", "Ljava/util/Random;", "(Ljava/util/Random;)V", "getImpl", "()Ljava/util/Random;", "Companion", "kotlin-stdlib"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
final class PlatformRandom extends AbstractPlatformRandom implements Serializable {
|
||||
private static final Companion Companion = new Companion(null);
|
||||
private static final long serialVersionUID = 0;
|
||||
private final java.util.Random impl;
|
||||
|
||||
@Override // kotlin.random.AbstractPlatformRandom
|
||||
public java.util.Random getImpl() {
|
||||
return this.impl;
|
||||
}
|
||||
|
||||
/* compiled from: PlatformRandom.kt */
|
||||
@Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\b\u0082\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000¨\u0006\u0005"}, d2 = {"Lkotlin/random/PlatformRandom$Companion;", "", "()V", "serialVersionUID", "", "kotlin-stdlib"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
||||
private static final class Companion {
|
||||
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
||||
this();
|
||||
}
|
||||
|
||||
private Companion() {
|
||||
}
|
||||
}
|
||||
|
||||
public PlatformRandom(java.util.Random impl) {
|
||||
Intrinsics.checkNotNullParameter(impl, "impl");
|
||||
this.impl = impl;
|
||||
}
|
||||
}
|
32
02-Easy5/E5/sources/kotlin/random/PlatformRandomKt.java
Normal file
32
02-Easy5/E5/sources/kotlin/random/PlatformRandomKt.java
Normal file
@ -0,0 +1,32 @@
|
||||
package kotlin.random;
|
||||
|
||||
import kotlin.Metadata;
|
||||
import kotlin.internal.PlatformImplementationsKt;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: PlatformRandom.kt */
|
||||
@Metadata(d1 = {"\u0000\u001e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0006\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u001a\t\u0010\u0000\u001a\u00020\u0001H\u0081\b\u001a\u0018\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00052\u0006\u0010\u0006\u001a\u00020\u0005H\u0000\u001a\f\u0010\u0007\u001a\u00020\b*\u00020\u0001H\u0007\u001a\f\u0010\t\u001a\u00020\u0001*\u00020\bH\u0007¨\u0006\n"}, d2 = {"defaultPlatformRandom", "Lkotlin/random/Random;", "doubleFromParts", "", "hi26", "", "low27", "asJavaRandom", "Ljava/util/Random;", "asKotlinRandom", "kotlin-stdlib"}, k = 2, mv = {1, 8, 0}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class PlatformRandomKt {
|
||||
public static final double doubleFromParts(int i, int i2) {
|
||||
return ((i << 27) + i2) / 9.007199254740992E15d;
|
||||
}
|
||||
|
||||
public static final java.util.Random asJavaRandom(Random random) {
|
||||
java.util.Random impl;
|
||||
Intrinsics.checkNotNullParameter(random, "<this>");
|
||||
AbstractPlatformRandom abstractPlatformRandom = random instanceof AbstractPlatformRandom ? (AbstractPlatformRandom) random : null;
|
||||
return (abstractPlatformRandom == null || (impl = abstractPlatformRandom.getImpl()) == null) ? new KotlinRandom(random) : impl;
|
||||
}
|
||||
|
||||
public static final Random asKotlinRandom(java.util.Random random) {
|
||||
Random impl;
|
||||
Intrinsics.checkNotNullParameter(random, "<this>");
|
||||
KotlinRandom kotlinRandom = random instanceof KotlinRandom ? (KotlinRandom) random : null;
|
||||
return (kotlinRandom == null || (impl = kotlinRandom.getImpl()) == null) ? new PlatformRandom(random) : impl;
|
||||
}
|
||||
|
||||
private static final Random defaultPlatformRandom() {
|
||||
return PlatformImplementationsKt.IMPLEMENTATIONS.defaultPlatformRandom();
|
||||
}
|
||||
}
|
284
02-Easy5/E5/sources/kotlin/random/Random.java
Normal file
284
02-Easy5/E5/sources/kotlin/random/Random.java
Normal file
@ -0,0 +1,284 @@
|
||||
package kotlin.random;
|
||||
|
||||
import androidx.constraintlayout.core.motion.utils.TypedValues;
|
||||
import java.io.Serializable;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.internal.PlatformImplementationsKt;
|
||||
import kotlin.jvm.internal.DefaultConstructorMarker;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
import kotlin.ranges.IntRange;
|
||||
|
||||
/* compiled from: Random.kt */
|
||||
@Metadata(d1 = {"\u0000:\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0012\n\u0002\b\u0005\n\u0002\u0010\u0006\n\u0002\b\u0003\n\u0002\u0010\u0007\n\u0002\b\u0002\n\u0002\u0010\t\n\u0002\b\u0002\b'\u0018\u0000 \u00172\u00020\u0001:\u0001\u0017B\u0005¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0004H&J\b\u0010\u0006\u001a\u00020\u0007H\u0016J\u0010\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\tH\u0016J$\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\t2\b\b\u0002\u0010\u000b\u001a\u00020\u00042\b\b\u0002\u0010\f\u001a\u00020\u0004H\u0016J\u0010\u0010\b\u001a\u00020\t2\u0006\u0010\r\u001a\u00020\u0004H\u0016J\b\u0010\u000e\u001a\u00020\u000fH\u0016J\u0010\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u000fH\u0016J\u0018\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u0011\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u000fH\u0016J\b\u0010\u0012\u001a\u00020\u0013H\u0016J\b\u0010\u0014\u001a\u00020\u0004H\u0016J\u0010\u0010\u0014\u001a\u00020\u00042\u0006\u0010\u0010\u001a\u00020\u0004H\u0016J\u0018\u0010\u0014\u001a\u00020\u00042\u0006\u0010\u0011\u001a\u00020\u00042\u0006\u0010\u0010\u001a\u00020\u0004H\u0016J\b\u0010\u0015\u001a\u00020\u0016H\u0016J\u0010\u0010\u0015\u001a\u00020\u00162\u0006\u0010\u0010\u001a\u00020\u0016H\u0016J\u0018\u0010\u0015\u001a\u00020\u00162\u0006\u0010\u0011\u001a\u00020\u00162\u0006\u0010\u0010\u001a\u00020\u0016H\u0016¨\u0006\u0018"}, d2 = {"Lkotlin/random/Random;", "", "()V", "nextBits", "", "bitCount", "nextBoolean", "", "nextBytes", "", "array", "fromIndex", "toIndex", "size", "nextDouble", "", "until", TypedValues.TransitionType.S_FROM, "nextFloat", "", "nextInt", "nextLong", "", "Default", "kotlin-stdlib"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class Random {
|
||||
|
||||
/* renamed from: Default, reason: from kotlin metadata */
|
||||
public static final Companion INSTANCE = new Companion(null);
|
||||
private static final Random defaultRandom = PlatformImplementationsKt.IMPLEMENTATIONS.defaultPlatformRandom();
|
||||
|
||||
public abstract int nextBits(int bitCount);
|
||||
|
||||
public int nextInt() {
|
||||
return nextBits(32);
|
||||
}
|
||||
|
||||
public int nextInt(int until) {
|
||||
return nextInt(0, until);
|
||||
}
|
||||
|
||||
public int nextInt(int from, int until) {
|
||||
int nextInt;
|
||||
int i;
|
||||
int i2;
|
||||
RandomKt.checkRangeBounds(from, until);
|
||||
int i3 = until - from;
|
||||
if (i3 > 0 || i3 == Integer.MIN_VALUE) {
|
||||
if (((-i3) & i3) == i3) {
|
||||
i2 = nextBits(RandomKt.fastLog2(i3));
|
||||
} else {
|
||||
do {
|
||||
nextInt = nextInt() >>> 1;
|
||||
i = nextInt % i3;
|
||||
} while ((nextInt - i) + (i3 - 1) < 0);
|
||||
i2 = i;
|
||||
}
|
||||
return from + i2;
|
||||
}
|
||||
while (true) {
|
||||
int nextInt2 = nextInt();
|
||||
if (from <= nextInt2 && nextInt2 < until) {
|
||||
return nextInt2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public long nextLong() {
|
||||
return (nextInt() << 32) + nextInt();
|
||||
}
|
||||
|
||||
public long nextLong(long until) {
|
||||
return nextLong(0L, until);
|
||||
}
|
||||
|
||||
public long nextLong(long from, long until) {
|
||||
long nextLong;
|
||||
long j;
|
||||
long j2;
|
||||
int nextInt;
|
||||
RandomKt.checkRangeBounds(from, until);
|
||||
long j3 = until - from;
|
||||
if (j3 > 0) {
|
||||
if (((-j3) & j3) == j3) {
|
||||
int i = (int) j3;
|
||||
int i2 = (int) (j3 >>> 32);
|
||||
if (i != 0) {
|
||||
nextInt = nextBits(RandomKt.fastLog2(i));
|
||||
} else if (i2 == 1) {
|
||||
nextInt = nextInt();
|
||||
} else {
|
||||
j2 = (nextBits(RandomKt.fastLog2(i2)) << 32) + (nextInt() & 4294967295L);
|
||||
}
|
||||
j2 = nextInt & 4294967295L;
|
||||
} else {
|
||||
do {
|
||||
nextLong = nextLong() >>> 1;
|
||||
j = nextLong % j3;
|
||||
} while ((nextLong - j) + (j3 - 1) < 0);
|
||||
j2 = j;
|
||||
}
|
||||
return from + j2;
|
||||
}
|
||||
while (true) {
|
||||
long nextLong2 = nextLong();
|
||||
if (from <= nextLong2 && nextLong2 < until) {
|
||||
return nextLong2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean nextBoolean() {
|
||||
return nextBits(1) != 0;
|
||||
}
|
||||
|
||||
public double nextDouble() {
|
||||
return PlatformRandomKt.doubleFromParts(nextBits(26), nextBits(27));
|
||||
}
|
||||
|
||||
public double nextDouble(double until) {
|
||||
return nextDouble(0.0d, until);
|
||||
}
|
||||
|
||||
public double nextDouble(double from, double until) {
|
||||
double nextDouble;
|
||||
RandomKt.checkRangeBounds(from, until);
|
||||
double d = until - from;
|
||||
if (Double.isInfinite(d) && !Double.isInfinite(from) && !Double.isNaN(from) && !Double.isInfinite(until) && !Double.isNaN(until)) {
|
||||
double d2 = 2;
|
||||
double nextDouble2 = nextDouble() * ((until / d2) - (from / d2));
|
||||
nextDouble = from + nextDouble2 + nextDouble2;
|
||||
} else {
|
||||
nextDouble = from + (nextDouble() * d);
|
||||
}
|
||||
return nextDouble >= until ? Math.nextAfter(until, Double.NEGATIVE_INFINITY) : nextDouble;
|
||||
}
|
||||
|
||||
public float nextFloat() {
|
||||
return nextBits(24) / 1.6777216E7f;
|
||||
}
|
||||
|
||||
public static /* synthetic */ byte[] nextBytes$default(Random random, byte[] bArr, int i, int i2, int i3, Object obj) {
|
||||
if (obj != null) {
|
||||
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: nextBytes");
|
||||
}
|
||||
if ((i3 & 2) != 0) {
|
||||
i = 0;
|
||||
}
|
||||
if ((i3 & 4) != 0) {
|
||||
i2 = bArr.length;
|
||||
}
|
||||
return random.nextBytes(bArr, i, i2);
|
||||
}
|
||||
|
||||
public byte[] nextBytes(byte[] array, int fromIndex, int toIndex) {
|
||||
Intrinsics.checkNotNullParameter(array, "array");
|
||||
if (!new IntRange(0, array.length).contains(fromIndex) || !new IntRange(0, array.length).contains(toIndex)) {
|
||||
throw new IllegalArgumentException(("fromIndex (" + fromIndex + ") or toIndex (" + toIndex + ") are out of range: 0.." + array.length + '.').toString());
|
||||
}
|
||||
if (fromIndex > toIndex) {
|
||||
throw new IllegalArgumentException(("fromIndex (" + fromIndex + ") must be not greater than toIndex (" + toIndex + ").").toString());
|
||||
}
|
||||
int i = (toIndex - fromIndex) / 4;
|
||||
for (int i2 = 0; i2 < i; i2++) {
|
||||
int nextInt = nextInt();
|
||||
array[fromIndex] = (byte) nextInt;
|
||||
array[fromIndex + 1] = (byte) (nextInt >>> 8);
|
||||
array[fromIndex + 2] = (byte) (nextInt >>> 16);
|
||||
array[fromIndex + 3] = (byte) (nextInt >>> 24);
|
||||
fromIndex += 4;
|
||||
}
|
||||
int i3 = toIndex - fromIndex;
|
||||
int nextBits = nextBits(i3 * 8);
|
||||
for (int i4 = 0; i4 < i3; i4++) {
|
||||
array[fromIndex + i4] = (byte) (nextBits >>> (i4 * 8));
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
public byte[] nextBytes(byte[] array) {
|
||||
Intrinsics.checkNotNullParameter(array, "array");
|
||||
return nextBytes(array, 0, array.length);
|
||||
}
|
||||
|
||||
public byte[] nextBytes(int size) {
|
||||
return nextBytes(new byte[size]);
|
||||
}
|
||||
|
||||
/* compiled from: Random.kt */
|
||||
@Metadata(d1 = {"\u0000H\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0012\n\u0002\b\u0005\n\u0002\u0010\u0006\n\u0002\b\u0003\n\u0002\u0010\u0007\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0002\b\u0086\u0003\u0018\u00002\u00020\u00012\u00060\u0002j\u0002`\u0003:\u0001\u001cB\u0007\b\u0002¢\u0006\u0002\u0010\u0004J\u0010\u0010\u0006\u001a\u00020\u00072\u0006\u0010\b\u001a\u00020\u0007H\u0016J\b\u0010\t\u001a\u00020\nH\u0016J\u0010\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\fH\u0016J \u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\f2\u0006\u0010\u000e\u001a\u00020\u00072\u0006\u0010\u000f\u001a\u00020\u0007H\u0016J\u0010\u0010\u000b\u001a\u00020\f2\u0006\u0010\u0010\u001a\u00020\u0007H\u0016J\b\u0010\u0011\u001a\u00020\u0012H\u0016J\u0010\u0010\u0011\u001a\u00020\u00122\u0006\u0010\u0013\u001a\u00020\u0012H\u0016J\u0018\u0010\u0011\u001a\u00020\u00122\u0006\u0010\u0014\u001a\u00020\u00122\u0006\u0010\u0013\u001a\u00020\u0012H\u0016J\b\u0010\u0015\u001a\u00020\u0016H\u0016J\b\u0010\u0017\u001a\u00020\u0007H\u0016J\u0010\u0010\u0017\u001a\u00020\u00072\u0006\u0010\u0013\u001a\u00020\u0007H\u0016J\u0018\u0010\u0017\u001a\u00020\u00072\u0006\u0010\u0014\u001a\u00020\u00072\u0006\u0010\u0013\u001a\u00020\u0007H\u0016J\b\u0010\u0018\u001a\u00020\u0019H\u0016J\u0010\u0010\u0018\u001a\u00020\u00192\u0006\u0010\u0013\u001a\u00020\u0019H\u0016J\u0018\u0010\u0018\u001a\u00020\u00192\u0006\u0010\u0014\u001a\u00020\u00192\u0006\u0010\u0013\u001a\u00020\u0019H\u0016J\b\u0010\u001a\u001a\u00020\u001bH\u0002R\u000e\u0010\u0005\u001a\u00020\u0001X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u001d"}, d2 = {"Lkotlin/random/Random$Default;", "Lkotlin/random/Random;", "Ljava/io/Serializable;", "Lkotlin/io/Serializable;", "()V", "defaultRandom", "nextBits", "", "bitCount", "nextBoolean", "", "nextBytes", "", "array", "fromIndex", "toIndex", "size", "nextDouble", "", "until", TypedValues.TransitionType.S_FROM, "nextFloat", "", "nextInt", "nextLong", "", "writeReplace", "", "Serialized", "kotlin-stdlib"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
||||
/* renamed from: kotlin.random.Random$Default, reason: from kotlin metadata */
|
||||
public static final class Companion extends Random implements Serializable {
|
||||
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
||||
this();
|
||||
}
|
||||
|
||||
private Companion() {
|
||||
}
|
||||
|
||||
/* compiled from: Random.kt */
|
||||
@Metadata(d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\n\u0002\u0010\u0000\n\u0000\bÂ\u0002\u0018\u00002\u00060\u0001j\u0002`\u0002B\u0007\b\u0002¢\u0006\u0002\u0010\u0003J\b\u0010\u0006\u001a\u00020\u0007H\u0002R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082T¢\u0006\u0002\n\u0000¨\u0006\b"}, d2 = {"Lkotlin/random/Random$Default$Serialized;", "Ljava/io/Serializable;", "Lkotlin/io/Serializable;", "()V", "serialVersionUID", "", "readResolve", "", "kotlin-stdlib"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
||||
/* renamed from: kotlin.random.Random$Default$Serialized */
|
||||
private static final class Serialized implements Serializable {
|
||||
public static final Serialized INSTANCE = new Serialized();
|
||||
private static final long serialVersionUID = 0;
|
||||
|
||||
private Serialized() {
|
||||
}
|
||||
|
||||
private final Object readResolve() {
|
||||
return Random.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
private final Object writeReplace() {
|
||||
return Serialized.INSTANCE;
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public int nextBits(int bitCount) {
|
||||
return Random.defaultRandom.nextBits(bitCount);
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public int nextInt() {
|
||||
return Random.defaultRandom.nextInt();
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public int nextInt(int until) {
|
||||
return Random.defaultRandom.nextInt(until);
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public int nextInt(int from, int until) {
|
||||
return Random.defaultRandom.nextInt(from, until);
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public long nextLong() {
|
||||
return Random.defaultRandom.nextLong();
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public long nextLong(long until) {
|
||||
return Random.defaultRandom.nextLong(until);
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public long nextLong(long from, long until) {
|
||||
return Random.defaultRandom.nextLong(from, until);
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public boolean nextBoolean() {
|
||||
return Random.defaultRandom.nextBoolean();
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public double nextDouble() {
|
||||
return Random.defaultRandom.nextDouble();
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public double nextDouble(double until) {
|
||||
return Random.defaultRandom.nextDouble(until);
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public double nextDouble(double from, double until) {
|
||||
return Random.defaultRandom.nextDouble(from, until);
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public float nextFloat() {
|
||||
return Random.defaultRandom.nextFloat();
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public byte[] nextBytes(byte[] array) {
|
||||
Intrinsics.checkNotNullParameter(array, "array");
|
||||
return Random.defaultRandom.nextBytes(array);
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public byte[] nextBytes(int size) {
|
||||
return Random.defaultRandom.nextBytes(size);
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public byte[] nextBytes(byte[] array, int fromIndex, int toIndex) {
|
||||
Intrinsics.checkNotNullParameter(array, "array");
|
||||
return Random.defaultRandom.nextBytes(array, fromIndex, toIndex);
|
||||
}
|
||||
}
|
||||
}
|
70
02-Easy5/E5/sources/kotlin/random/RandomKt.java
Normal file
70
02-Easy5/E5/sources/kotlin/random/RandomKt.java
Normal file
@ -0,0 +1,70 @@
|
||||
package kotlin.random;
|
||||
|
||||
import androidx.constraintlayout.core.motion.utils.TypedValues;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
import kotlin.ranges.IntRange;
|
||||
import kotlin.ranges.LongRange;
|
||||
|
||||
/* compiled from: Random.kt */
|
||||
@Metadata(d1 = {"\u0000:\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\u0010\t\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\u0010\u0006\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\u001a\u0010\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\u0007\u001a\u0010\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0004H\u0007\u001a\u0018\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\bH\u0000\u001a\u0018\u0010\n\u001a\u00020\u000b2\u0006\u0010\u0007\u001a\u00020\f2\u0006\u0010\t\u001a\u00020\fH\u0000\u001a\u0018\u0010\n\u001a\u00020\u000b2\u0006\u0010\u0007\u001a\u00020\u00032\u0006\u0010\t\u001a\u00020\u0003H\u0000\u001a\u0018\u0010\n\u001a\u00020\u000b2\u0006\u0010\u0007\u001a\u00020\u00042\u0006\u0010\t\u001a\u00020\u0004H\u0000\u001a\u0010\u0010\r\u001a\u00020\u00032\u0006\u0010\u000e\u001a\u00020\u0003H\u0000\u001a\u0014\u0010\u000f\u001a\u00020\u0003*\u00020\u00012\u0006\u0010\u0010\u001a\u00020\u0011H\u0007\u001a\u0014\u0010\u0012\u001a\u00020\u0004*\u00020\u00012\u0006\u0010\u0010\u001a\u00020\u0013H\u0007\u001a\u0014\u0010\u0014\u001a\u00020\u0003*\u00020\u00032\u0006\u0010\u0015\u001a\u00020\u0003H\u0000¨\u0006\u0016"}, d2 = {"Random", "Lkotlin/random/Random;", "seed", "", "", "boundsErrorMessage", "", TypedValues.TransitionType.S_FROM, "", "until", "checkRangeBounds", "", "", "fastLog2", "value", "nextInt", "range", "Lkotlin/ranges/IntRange;", "nextLong", "Lkotlin/ranges/LongRange;", "takeUpperBits", "bitCount", "kotlin-stdlib"}, k = 2, mv = {1, 8, 0}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class RandomKt {
|
||||
public static final int takeUpperBits(int i, int i2) {
|
||||
return (i >>> (32 - i2)) & ((-i2) >> 31);
|
||||
}
|
||||
|
||||
public static final Random Random(int i) {
|
||||
return new XorWowRandom(i, i >> 31);
|
||||
}
|
||||
|
||||
public static final Random Random(long j) {
|
||||
return new XorWowRandom((int) j, (int) (j >> 32));
|
||||
}
|
||||
|
||||
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 long nextLong(Random random, LongRange range) {
|
||||
Intrinsics.checkNotNullParameter(random, "<this>");
|
||||
Intrinsics.checkNotNullParameter(range, "range");
|
||||
if (!range.isEmpty()) {
|
||||
return range.getLast() < Long.MAX_VALUE ? random.nextLong(range.getFirst(), range.getLast() + 1) : range.getFirst() > Long.MIN_VALUE ? random.nextLong(range.getFirst() - 1, range.getLast()) + 1 : random.nextLong();
|
||||
}
|
||||
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 void checkRangeBounds(double d, double d2) {
|
||||
if (d2 <= d) {
|
||||
throw new IllegalArgumentException(boundsErrorMessage(Double.valueOf(d), Double.valueOf(d2)).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 + ").";
|
||||
}
|
||||
}
|
137
02-Easy5/E5/sources/kotlin/random/URandomKt.java
Normal file
137
02-Easy5/E5/sources/kotlin/random/URandomKt.java
Normal file
@ -0,0 +1,137 @@
|
||||
package kotlin.random;
|
||||
|
||||
import androidx.constraintlayout.core.motion.utils.TypedValues;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.UByteArray;
|
||||
import kotlin.UInt;
|
||||
import kotlin.ULong;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
import kotlin.ranges.UIntRange;
|
||||
import kotlin.ranges.ULongRange;
|
||||
|
||||
/* compiled from: URandom.kt */
|
||||
@Metadata(d1 = {"\u0000:\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u000f\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0002\u001a\"\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u0003H\u0000ø\u0001\u0000¢\u0006\u0004\b\u0005\u0010\u0006\u001a\"\u0010\u0007\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\b2\u0006\u0010\u0004\u001a\u00020\bH\u0000ø\u0001\u0000¢\u0006\u0004\b\t\u0010\n\u001a\u001c\u0010\u000b\u001a\u00020\f*\u00020\r2\u0006\u0010\u000e\u001a\u00020\u000fH\u0007ø\u0001\u0000¢\u0006\u0002\u0010\u0010\u001a\u001e\u0010\u000b\u001a\u00020\f*\u00020\r2\u0006\u0010\u0011\u001a\u00020\fH\u0007ø\u0001\u0000¢\u0006\u0004\b\u0012\u0010\u0013\u001a2\u0010\u000b\u001a\u00020\f*\u00020\r2\u0006\u0010\u0011\u001a\u00020\f2\b\b\u0002\u0010\u0014\u001a\u00020\u000f2\b\b\u0002\u0010\u0015\u001a\u00020\u000fH\u0007ø\u0001\u0000¢\u0006\u0004\b\u0016\u0010\u0017\u001a\u0014\u0010\u0018\u001a\u00020\u0003*\u00020\rH\u0007ø\u0001\u0000¢\u0006\u0002\u0010\u0019\u001a\u001e\u0010\u0018\u001a\u00020\u0003*\u00020\r2\u0006\u0010\u0004\u001a\u00020\u0003H\u0007ø\u0001\u0000¢\u0006\u0004\b\u001a\u0010\u001b\u001a&\u0010\u0018\u001a\u00020\u0003*\u00020\r2\u0006\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u0003H\u0007ø\u0001\u0000¢\u0006\u0004\b\u001c\u0010\u001d\u001a\u001c\u0010\u0018\u001a\u00020\u0003*\u00020\r2\u0006\u0010\u001e\u001a\u00020\u001fH\u0007ø\u0001\u0000¢\u0006\u0002\u0010 \u001a\u0014\u0010!\u001a\u00020\b*\u00020\rH\u0007ø\u0001\u0000¢\u0006\u0002\u0010\"\u001a\u001e\u0010!\u001a\u00020\b*\u00020\r2\u0006\u0010\u0004\u001a\u00020\bH\u0007ø\u0001\u0000¢\u0006\u0004\b#\u0010$\u001a&\u0010!\u001a\u00020\b*\u00020\r2\u0006\u0010\u0002\u001a\u00020\b2\u0006\u0010\u0004\u001a\u00020\bH\u0007ø\u0001\u0000¢\u0006\u0004\b%\u0010&\u001a\u001c\u0010!\u001a\u00020\b*\u00020\r2\u0006\u0010\u001e\u001a\u00020'H\u0007ø\u0001\u0000¢\u0006\u0002\u0010(\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006)"}, d2 = {"checkUIntRangeBounds", "", TypedValues.TransitionType.S_FROM, "Lkotlin/UInt;", "until", "checkUIntRangeBounds-J1ME1BU", "(II)V", "checkULongRangeBounds", "Lkotlin/ULong;", "checkULongRangeBounds-eb3DHEI", "(JJ)V", "nextUBytes", "Lkotlin/UByteArray;", "Lkotlin/random/Random;", "size", "", "(Lkotlin/random/Random;I)[B", "array", "nextUBytes-EVgfTAA", "(Lkotlin/random/Random;[B)[B", "fromIndex", "toIndex", "nextUBytes-Wvrt4B4", "(Lkotlin/random/Random;[BII)[B", "nextUInt", "(Lkotlin/random/Random;)I", "nextUInt-qCasIEU", "(Lkotlin/random/Random;I)I", "nextUInt-a8DCA5k", "(Lkotlin/random/Random;II)I", "range", "Lkotlin/ranges/UIntRange;", "(Lkotlin/random/Random;Lkotlin/ranges/UIntRange;)I", "nextULong", "(Lkotlin/random/Random;)J", "nextULong-V1Xi4fY", "(Lkotlin/random/Random;J)J", "nextULong-jmpaW-c", "(Lkotlin/random/Random;JJ)J", "Lkotlin/ranges/ULongRange;", "(Lkotlin/random/Random;Lkotlin/ranges/ULongRange;)J", "kotlin-stdlib"}, k = 2, mv = {1, 8, 0}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class URandomKt {
|
||||
public static final int nextUInt(Random random) {
|
||||
Intrinsics.checkNotNullParameter(random, "<this>");
|
||||
return UInt.m384constructorimpl(random.nextInt());
|
||||
}
|
||||
|
||||
/* renamed from: nextUInt-qCasIEU, reason: not valid java name */
|
||||
public static final int m1545nextUIntqCasIEU(Random nextUInt, int i) {
|
||||
Intrinsics.checkNotNullParameter(nextUInt, "$this$nextUInt");
|
||||
return m1544nextUInta8DCA5k(nextUInt, 0, i);
|
||||
}
|
||||
|
||||
/* renamed from: nextUInt-a8DCA5k, reason: not valid java name */
|
||||
public static final int m1544nextUInta8DCA5k(Random nextUInt, int i, int i2) {
|
||||
Intrinsics.checkNotNullParameter(nextUInt, "$this$nextUInt");
|
||||
m1539checkUIntRangeBoundsJ1ME1BU(i, i2);
|
||||
return UInt.m384constructorimpl(nextUInt.nextInt(i ^ Integer.MIN_VALUE, i2 ^ Integer.MIN_VALUE) ^ Integer.MIN_VALUE);
|
||||
}
|
||||
|
||||
public static final int nextUInt(Random random, UIntRange range) {
|
||||
int compare;
|
||||
int compare2;
|
||||
Intrinsics.checkNotNullParameter(random, "<this>");
|
||||
Intrinsics.checkNotNullParameter(range, "range");
|
||||
if (range.isEmpty()) {
|
||||
throw new IllegalArgumentException("Cannot get random in empty range: " + range);
|
||||
}
|
||||
compare = Integer.compare(range.getLast() ^ Integer.MIN_VALUE, (-1) ^ Integer.MIN_VALUE);
|
||||
if (compare < 0) {
|
||||
return m1544nextUInta8DCA5k(random, range.getFirst(), UInt.m384constructorimpl(range.getLast() + 1));
|
||||
}
|
||||
compare2 = Integer.compare(range.getFirst() ^ Integer.MIN_VALUE, 0 ^ Integer.MIN_VALUE);
|
||||
return compare2 > 0 ? UInt.m384constructorimpl(m1544nextUInta8DCA5k(random, UInt.m384constructorimpl(range.getFirst() - 1), range.getLast()) + 1) : nextUInt(random);
|
||||
}
|
||||
|
||||
public static final long nextULong(Random random) {
|
||||
Intrinsics.checkNotNullParameter(random, "<this>");
|
||||
return ULong.m463constructorimpl(random.nextLong());
|
||||
}
|
||||
|
||||
/* renamed from: nextULong-V1Xi4fY, reason: not valid java name */
|
||||
public static final long m1546nextULongV1Xi4fY(Random nextULong, long j) {
|
||||
Intrinsics.checkNotNullParameter(nextULong, "$this$nextULong");
|
||||
return m1547nextULongjmpaWc(nextULong, 0L, j);
|
||||
}
|
||||
|
||||
/* renamed from: nextULong-jmpaW-c, reason: not valid java name */
|
||||
public static final long m1547nextULongjmpaWc(Random nextULong, long j, long j2) {
|
||||
Intrinsics.checkNotNullParameter(nextULong, "$this$nextULong");
|
||||
m1540checkULongRangeBoundseb3DHEI(j, j2);
|
||||
return ULong.m463constructorimpl(nextULong.nextLong(j ^ Long.MIN_VALUE, j2 ^ Long.MIN_VALUE) ^ Long.MIN_VALUE);
|
||||
}
|
||||
|
||||
public static final long nextULong(Random random, ULongRange range) {
|
||||
int compare;
|
||||
int compare2;
|
||||
Intrinsics.checkNotNullParameter(random, "<this>");
|
||||
Intrinsics.checkNotNullParameter(range, "range");
|
||||
if (range.isEmpty()) {
|
||||
throw new IllegalArgumentException("Cannot get random in empty range: " + range);
|
||||
}
|
||||
compare = Long.compare(range.getLast() ^ Long.MIN_VALUE, (-1) ^ Long.MIN_VALUE);
|
||||
if (compare < 0) {
|
||||
return m1547nextULongjmpaWc(random, range.getFirst(), ULong.m463constructorimpl(range.getLast() + ULong.m463constructorimpl(1 & 4294967295L)));
|
||||
}
|
||||
compare2 = Long.compare(range.getFirst() ^ Long.MIN_VALUE, 0 ^ Long.MIN_VALUE);
|
||||
if (compare2 <= 0) {
|
||||
return nextULong(random);
|
||||
}
|
||||
long j = 1 & 4294967295L;
|
||||
return ULong.m463constructorimpl(m1547nextULongjmpaWc(random, ULong.m463constructorimpl(range.getFirst() - ULong.m463constructorimpl(j)), range.getLast()) + ULong.m463constructorimpl(j));
|
||||
}
|
||||
|
||||
/* renamed from: nextUBytes-EVgfTAA, reason: not valid java name */
|
||||
public static final byte[] m1541nextUBytesEVgfTAA(Random nextUBytes, byte[] array) {
|
||||
Intrinsics.checkNotNullParameter(nextUBytes, "$this$nextUBytes");
|
||||
Intrinsics.checkNotNullParameter(array, "array");
|
||||
nextUBytes.nextBytes(array);
|
||||
return array;
|
||||
}
|
||||
|
||||
public static final byte[] nextUBytes(Random random, int i) {
|
||||
Intrinsics.checkNotNullParameter(random, "<this>");
|
||||
return UByteArray.m360constructorimpl(random.nextBytes(i));
|
||||
}
|
||||
|
||||
/* renamed from: nextUBytes-Wvrt4B4$default, reason: not valid java name */
|
||||
public static /* synthetic */ byte[] m1543nextUBytesWvrt4B4$default(Random random, byte[] bArr, int i, int i2, int i3, Object obj) {
|
||||
if ((i3 & 2) != 0) {
|
||||
i = 0;
|
||||
}
|
||||
if ((i3 & 4) != 0) {
|
||||
i2 = UByteArray.m366getSizeimpl(bArr);
|
||||
}
|
||||
return m1542nextUBytesWvrt4B4(random, bArr, i, i2);
|
||||
}
|
||||
|
||||
/* renamed from: nextUBytes-Wvrt4B4, reason: not valid java name */
|
||||
public static final byte[] m1542nextUBytesWvrt4B4(Random nextUBytes, byte[] array, int i, int i2) {
|
||||
Intrinsics.checkNotNullParameter(nextUBytes, "$this$nextUBytes");
|
||||
Intrinsics.checkNotNullParameter(array, "array");
|
||||
nextUBytes.nextBytes(array, i, i2);
|
||||
return array;
|
||||
}
|
||||
|
||||
/* renamed from: checkUIntRangeBounds-J1ME1BU, reason: not valid java name */
|
||||
public static final void m1539checkUIntRangeBoundsJ1ME1BU(int i, int i2) {
|
||||
int compare;
|
||||
compare = Integer.compare(i2 ^ Integer.MIN_VALUE, i ^ Integer.MIN_VALUE);
|
||||
if (compare <= 0) {
|
||||
throw new IllegalArgumentException(RandomKt.boundsErrorMessage(UInt.m378boximpl(i), UInt.m378boximpl(i2)).toString());
|
||||
}
|
||||
}
|
||||
|
||||
/* renamed from: checkULongRangeBounds-eb3DHEI, reason: not valid java name */
|
||||
public static final void m1540checkULongRangeBoundseb3DHEI(long j, long j2) {
|
||||
int compare;
|
||||
compare = Long.compare(j2 ^ Long.MIN_VALUE, j ^ Long.MIN_VALUE);
|
||||
if (compare <= 0) {
|
||||
throw new IllegalArgumentException(RandomKt.boundsErrorMessage(ULong.m457boximpl(j), ULong.m457boximpl(j2)).toString());
|
||||
}
|
||||
}
|
||||
}
|
70
02-Easy5/E5/sources/kotlin/random/XorWowRandom.java
Normal file
70
02-Easy5/E5/sources/kotlin/random/XorWowRandom.java
Normal file
@ -0,0 +1,70 @@
|
||||
package kotlin.random;
|
||||
|
||||
import java.io.Serializable;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.DefaultConstructorMarker;
|
||||
|
||||
/* compiled from: XorWowRandom.kt */
|
||||
@Metadata(d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u000e\b\u0000\u0018\u0000 \u00122\u00020\u00012\u00060\u0002j\u0002`\u0003:\u0001\u0012B\u0017\b\u0010\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0005¢\u0006\u0002\u0010\u0007B7\b\u0000\u0012\u0006\u0010\b\u001a\u00020\u0005\u0012\u0006\u0010\t\u001a\u00020\u0005\u0012\u0006\u0010\n\u001a\u00020\u0005\u0012\u0006\u0010\u000b\u001a\u00020\u0005\u0012\u0006\u0010\f\u001a\u00020\u0005\u0012\u0006\u0010\r\u001a\u00020\u0005¢\u0006\u0002\u0010\u000eJ\u0010\u0010\u000f\u001a\u00020\u00052\u0006\u0010\u0010\u001a\u00020\u0005H\u0016J\b\u0010\u0011\u001a\u00020\u0005H\u0016R\u000e\u0010\r\u001a\u00020\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u0005X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u0013"}, d2 = {"Lkotlin/random/XorWowRandom;", "Lkotlin/random/Random;", "Ljava/io/Serializable;", "Lkotlin/io/Serializable;", "seed1", "", "seed2", "(II)V", "x", "y", "z", "w", "v", "addend", "(IIIIII)V", "nextBits", "bitCount", "nextInt", "Companion", "kotlin-stdlib"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class XorWowRandom extends Random implements Serializable {
|
||||
private static final Companion Companion = new Companion(null);
|
||||
private static final long serialVersionUID = 0;
|
||||
private int addend;
|
||||
private int v;
|
||||
private int w;
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public int nextInt() {
|
||||
int i = this.x;
|
||||
int i2 = i ^ (i >>> 2);
|
||||
this.x = this.y;
|
||||
this.y = this.z;
|
||||
this.z = this.w;
|
||||
int i3 = this.v;
|
||||
this.w = i3;
|
||||
int i4 = ((i2 ^ (i2 << 1)) ^ i3) ^ (i3 << 4);
|
||||
this.v = i4;
|
||||
int i5 = this.addend + 362437;
|
||||
this.addend = i5;
|
||||
return i4 + i5;
|
||||
}
|
||||
|
||||
public XorWowRandom(int i, int i2, int i3, int i4, int i5, int i6) {
|
||||
this.x = i;
|
||||
this.y = i2;
|
||||
this.z = i3;
|
||||
this.w = i4;
|
||||
this.v = i5;
|
||||
this.addend = i6;
|
||||
if ((i | i2 | i3 | i4 | i5) == 0) {
|
||||
throw new IllegalArgumentException("Initial state must have at least one non-zero element.".toString());
|
||||
}
|
||||
for (int i7 = 0; i7 < 64; i7++) {
|
||||
nextInt();
|
||||
}
|
||||
}
|
||||
|
||||
public XorWowRandom(int i, int i2) {
|
||||
this(i, i2, 0, 0, ~i, (i << 10) ^ (i2 >>> 4));
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public int nextBits(int bitCount) {
|
||||
return RandomKt.takeUpperBits(nextInt(), bitCount);
|
||||
}
|
||||
|
||||
/* compiled from: XorWowRandom.kt */
|
||||
@Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\b\u0082\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000¨\u0006\u0005"}, d2 = {"Lkotlin/random/XorWowRandom$Companion;", "", "()V", "serialVersionUID", "", "kotlin-stdlib"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
||||
private static final class Companion {
|
||||
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
||||
this();
|
||||
}
|
||||
|
||||
private Companion() {
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package kotlin.random.jdk8;
|
||||
|
||||
import androidx.constraintlayout.core.motion.utils.TypedValues;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
import kotlin.random.AbstractPlatformRandom;
|
||||
|
||||
/* compiled from: PlatformThreadLocalRandom.kt */
|
||||
@Metadata(d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0006\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\b\u0000\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\bH\u0016J\u0018\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\u000b2\u0006\u0010\t\u001a\u00020\u000bH\u0016J\u0010\u0010\r\u001a\u00020\u000e2\u0006\u0010\t\u001a\u00020\u000eH\u0016J\u0018\u0010\r\u001a\u00020\u000e2\u0006\u0010\f\u001a\u00020\u000e2\u0006\u0010\t\u001a\u00020\u000eH\u0016R\u0014\u0010\u0003\u001a\u00020\u00048VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0005\u0010\u0006¨\u0006\u000f"}, d2 = {"Lkotlin/random/jdk8/PlatformThreadLocalRandom;", "Lkotlin/random/AbstractPlatformRandom;", "()V", "impl", "Ljava/util/Random;", "getImpl", "()Ljava/util/Random;", "nextDouble", "", "until", "nextInt", "", TypedValues.TransitionType.S_FROM, "nextLong", "", "kotlin-stdlib-jdk8"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class PlatformThreadLocalRandom extends AbstractPlatformRandom {
|
||||
@Override // kotlin.random.AbstractPlatformRandom
|
||||
public Random getImpl() {
|
||||
ThreadLocalRandom current = ThreadLocalRandom.current();
|
||||
Intrinsics.checkNotNullExpressionValue(current, "current()");
|
||||
return current;
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public int nextInt(int from, int until) {
|
||||
return ThreadLocalRandom.current().nextInt(from, until);
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public long nextLong(long until) {
|
||||
return ThreadLocalRandom.current().nextLong(until);
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public long nextLong(long from, long until) {
|
||||
return ThreadLocalRandom.current().nextLong(from, until);
|
||||
}
|
||||
|
||||
@Override // kotlin.random.Random
|
||||
public double nextDouble(double until) {
|
||||
return ThreadLocalRandom.current().nextDouble(until);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user