From 65d24439b8f8f51d47eab7f88cdb314f6952684a Mon Sep 17 00:00:00 2001 From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com> Date: Mon, 21 Apr 2025 06:40:31 +1400 Subject: [PATCH] Mark FasterRandomSource direct impl as static final --- .../org/dreeam/leaf/util/math/random/FasterRandomSource.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/leaf-server/src/main/java/org/dreeam/leaf/util/math/random/FasterRandomSource.java b/leaf-server/src/main/java/org/dreeam/leaf/util/math/random/FasterRandomSource.java index 46c9c1e7..ee6d5dc5 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/util/math/random/FasterRandomSource.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/util/math/random/FasterRandomSource.java @@ -20,20 +20,18 @@ public class FasterRandomSource implements BitRandomSource { private static final RandomGeneratorFactory RANDOM_GENERATOR_FACTORY = RandomGeneratorFactory.of(FastRNG.randomGenerator); private static final boolean isSplittableGenerator = RANDOM_GENERATOR_FACTORY.isSplittable(); private long seed; - private boolean useDirectImpl; + private static final boolean useDirectImpl = FastRNG.useDirectImpl; private RandomGenerator randomGenerator; public static final FasterRandomSource SHARED_INSTANCE = new FasterRandomSource(ThreadLocalRandom.current().nextLong()); public FasterRandomSource(long seed) { this.seed = seed; this.randomGenerator = RANDOM_GENERATOR_FACTORY.create(seed); - this.useDirectImpl = FastRNG.useDirectImpl; // Get the value from config } private FasterRandomSource(long seed, RandomGenerator.SplittableGenerator randomGenerator) { this.seed = seed; this.randomGenerator = randomGenerator; - this.useDirectImpl = FastRNG.useDirectImpl; } @Override @@ -59,7 +57,6 @@ public class FasterRandomSource implements BitRandomSource { @Override public final int next(int bits) { if (useDirectImpl) { - // Direct return (int) ((seed = seed * MULTIPLIER + INCREMENT & SEED_MASK) >>> (INT_BITS - bits)); }