--- a/src/java.base/share/classes/java/util/random/Xoshiro256StarStar.java Fri Jul 26 15:20:31 2019 -0300
+++ b/src/java.base/share/classes/java/util/random/Xoshiro256StarStar.java Fri Jul 26 15:37:05 2019 -0300
@@ -27,12 +27,13 @@
import java.math.BigInteger;
import java.util.concurrent.atomic.AtomicLong;
+import java.util.random.RandomGenerator.LeapableGenerator;
/**
* A generator of uniform pseudorandom values applicable for use in
* (among other contexts) isolated parallel computations that may
* generate subtasks. Class {@link Xoshiro256StarStar} implements
- * interfaces {@link RandomNumberGenerator} and {@link LeapableRNG},
+ * interfaces {@link RandomGenerator} and {@link LeapableGenerator},
* 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 {@link Xoshiro256StarStar} objects
@@ -89,7 +90,7 @@
*
* @since 14
*/
-public final class Xoshiro256StarStar implements LeapableRNG {
+public final class Xoshiro256StarStar implements LeapableGenerator {
/*
* Implementation Overview.
@@ -128,7 +129,7 @@
/**
* The seed generator for default constructors.
*/
- private static final AtomicLong DEFAULT_GEN = new AtomicLong(RNGSupport.initialSeed());
+ private static final AtomicLong DEFAULT_GEN = new AtomicLong(RandomSupport.initialSeed());
/*
* The period of this generator, which is 2**256 - 1.
@@ -164,10 +165,10 @@
// If x0, x1, x2, and x3 are all zero, we must choose nonzero values.
if ((x0 | x1 | x2 | x3) == 0) {
// At least three of the four values generated here will be nonzero.
- this.x0 = RNGSupport.mixStafford13(x0 += RNGSupport.GOLDEN_RATIO_64);
- this.x1 = (x0 += RNGSupport.GOLDEN_RATIO_64);
- this.x2 = (x0 += RNGSupport.GOLDEN_RATIO_64);
- this.x3 = (x0 += RNGSupport.GOLDEN_RATIO_64);
+ this.x0 = RandomSupport.mixStafford13(x0 += RandomSupport.GOLDEN_RATIO_64);
+ this.x1 = (x0 += RandomSupport.GOLDEN_RATIO_64);
+ this.x2 = (x0 += RandomSupport.GOLDEN_RATIO_64);
+ this.x3 = (x0 += RandomSupport.GOLDEN_RATIO_64);
}
}
@@ -186,10 +187,10 @@
//
// The x values are then filled in as if by a SplitMix PRNG with
// GOLDEN_RATIO_64 as the gamma value and Stafford13 as the mixer.
- this(RNGSupport.mixStafford13(seed ^= RNGSupport.SILVER_RATIO_64),
- RNGSupport.mixStafford13(seed += RNGSupport.GOLDEN_RATIO_64),
- RNGSupport.mixStafford13(seed += RNGSupport.GOLDEN_RATIO_64),
- RNGSupport.mixStafford13(seed + RNGSupport.GOLDEN_RATIO_64));
+ this(RandomSupport.mixStafford13(seed ^= RandomSupport.SILVER_RATIO_64),
+ RandomSupport.mixStafford13(seed += RandomSupport.GOLDEN_RATIO_64),
+ RandomSupport.mixStafford13(seed += RandomSupport.GOLDEN_RATIO_64),
+ RandomSupport.mixStafford13(seed + RandomSupport.GOLDEN_RATIO_64));
}
/**
@@ -200,7 +201,7 @@
*/
public Xoshiro256StarStar() {
// Using GOLDEN_RATIO_64 here gives us a good Weyl sequence of values.
- this(DEFAULT_GEN.getAndAdd(RNGSupport.GOLDEN_RATIO_64));
+ this(DEFAULT_GEN.getAndAdd(RandomSupport.GOLDEN_RATIO_64));
}
/**
@@ -212,7 +213,7 @@
*/
public Xoshiro256StarStar(byte[] seed) {
// Convert the seed to 4 long values, which are not all zero.
- long[] data = RNGSupport.convertSeedBytesToLongs(seed, 4, 4);
+ long[] data = RandomSupport.convertSeedBytesToLongs(seed, 4, 4);
long x0 = data[0], x1 = data[1], x2 = data[2], x3 = data[3];
this.x0 = x0;
this.x1 = x1;