--- a/src/java.base/share/classes/java/util/random/L32X64MixRandom.java Fri Jul 26 15:20:31 2019 -0300
+++ b/src/java.base/share/classes/java/util/random/L32X64MixRandom.java Fri Jul 26 15:37:05 2019 -0300
@@ -27,12 +27,14 @@
import java.math.BigInteger;
import java.util.concurrent.atomic.AtomicLong;
+import java.util.random.RandomGenerator.SplittableGenerator;
+import java.util.random.RandomSupport.AbstractSplittableGenerator;
/**
* A generator of uniform pseudorandom values applicable for use in
* (among other contexts) isolated parallel computations that may
* generate subtasks. Class {@link L32X64MixRandom} implements
- * interfaces {@link RandomNumberGenerator} and {@link SplittableRNG},
+ * interfaces {@link RandomGenerator} and {@link SplittableGenerator},
* and therefore supports methods for producing pseudorandomly chosen
* numbers of type {@code int}, {@code long}, {@code float}, and {@code double}
* as well as creating new split-off {@link L32X64MixRandom} objects,
@@ -134,7 +136,7 @@
*
* @since 14
*/
-public final class L32X64MixRandom extends AbstractSplittableRNG {
+public final class L32X64MixRandom extends AbstractSplittableGenerator {
/*
* Implementation Overview.
@@ -168,7 +170,7 @@
/**
* The seed generator for default constructors.
*/
- private static final AtomicLong defaultGen = new AtomicLong(RNGSupport.initialSeed());
+ private static final AtomicLong defaultGen = new AtomicLong(RandomSupport.initialSeed());
/*
* The period of this generator, which is (2**64 - 1) * 2**32.
@@ -219,8 +221,8 @@
// If x0 and x1 are both zero, we must choose nonzero values.
if ((x0 | x1) == 0) {
// At least one of the two values generated here will be nonzero.
- this.x0 = RNGSupport.mixMurmur32(s += RNGSupport.GOLDEN_RATIO_32);
- this.x1 = RNGSupport.mixMurmur32(s + RNGSupport.GOLDEN_RATIO_32);
+ this.x0 = RandomSupport.mixMurmur32(s += RandomSupport.GOLDEN_RATIO_32);
+ this.x1 = RandomSupport.mixMurmur32(s + RandomSupport.GOLDEN_RATIO_32);
}
}
@@ -242,10 +244,10 @@
// which will then be used to produce the first generated value.
// Then x1 is filled in as if by a SplitMix PRNG with
// GOLDEN_RATIO_32 as the gamma value and Murmur32 as the mixer.
- this(RNGSupport.mixMurmur32((int)((seed ^= RNGSupport.SILVER_RATIO_64) >>> 32)),
+ this(RandomSupport.mixMurmur32((int)((seed ^= RandomSupport.SILVER_RATIO_64) >>> 32)),
1,
- RNGSupport.mixLea32((int)(seed)),
- RNGSupport.mixLea32((int)(seed) + RNGSupport.GOLDEN_RATIO_32));
+ RandomSupport.mixLea32((int)(seed)),
+ RandomSupport.mixLea32((int)(seed) + RandomSupport.GOLDEN_RATIO_32));
}
/**
@@ -256,7 +258,7 @@
*/
public L32X64MixRandom() {
// Using GOLDEN_RATIO_64 here gives us a good Weyl sequence of values.
- this(defaultGen.getAndAdd(RNGSupport.GOLDEN_RATIO_64));
+ this(defaultGen.getAndAdd(RandomSupport.GOLDEN_RATIO_64));
}
/**
@@ -268,7 +270,7 @@
*/
public L32X64MixRandom(byte[] seed) {
// Convert the seed to 4 int values, of which the last 2 are not all zero.
- int[] data = RNGSupport.convertSeedBytesToInts(seed, 4, 2);
+ int[] data = RandomSupport.convertSeedBytesToInts(seed, 4, 2);
int a = data[0], s = data[1], x0 = data[2], x1 = data[3];
// Force a to be odd.
this.a = a | 1;
@@ -288,12 +290,12 @@
* the same expected statistical properties apply to the entire set of generators constructed by
* such recursive splitting.
*
- * @param source a {@link SplittableRNG} instance to be used instead of this one as a source of
+ * @param source a {@link SplittableGenerator} instance to be used instead of this one as a source of
* pseudorandom bits used to initialize the state of the new ones.
*
* @return a new instance of {@link L32X64MixRandom}
*/
- public L32X64MixRandom split(SplittableRNG source) {
+ public L32X64MixRandom split(SplittableGenerator source) {
// Literally pick a new instance "at random".
return new L32X64MixRandom(source.nextInt(), source.nextInt(),
source.nextInt(), source.nextInt());