src/java.base/share/classes/java/util/random/Xoroshiro128StarStar.java
branchJDK-8193209-branch
changeset 57547 56cbdc3ea079
parent 57437 f02ffcb61dce
child 59080 1b314be4feb2
--- a/src/java.base/share/classes/java/util/random/Xoroshiro128StarStar.java	Fri Jul 26 15:20:31 2019 -0300
+++ b/src/java.base/share/classes/java/util/random/Xoroshiro128StarStar.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 Xoroshiro128StarStar} 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 Xoroshiro128StarStar} objects
@@ -81,7 +82,7 @@
  *
  * @since 14
  */
-public final class Xoroshiro128StarStar implements LeapableRNG {
+public final class Xoroshiro128StarStar implements LeapableGenerator {
 
     /*
      * Implementation Overview.
@@ -114,7 +115,7 @@
      *
      * File organization: First the non-public methods that constitute the
      * main algorithm, then the public methods.  Note that many methods are
-     * defined by classes {@link AbstractJumpableRNG} and {@link AbstractRNG}.
+     * defined by classes {@link AbstractJumpableGenerator} and {@link AbstractGenerator}.
      */
 
     /* ---------------- static fields ---------------- */
@@ -122,7 +123,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**128 - 1.
@@ -154,8 +155,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.mixStafford13(x0 += RNGSupport.GOLDEN_RATIO_64);
-            this.x1 = (x0 += RNGSupport.GOLDEN_RATIO_64);
+            this.x0 = RandomSupport.mixStafford13(x0 += RandomSupport.GOLDEN_RATIO_64);
+            this.x1 = (x0 += RandomSupport.GOLDEN_RATIO_64);
         }
     }
 
@@ -174,8 +175,8 @@
         //
         // 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));
+        this(RandomSupport.mixStafford13(seed ^= RandomSupport.SILVER_RATIO_64),
+             RandomSupport.mixStafford13(seed + RandomSupport.GOLDEN_RATIO_64));
     }
 
     /**
@@ -186,7 +187,7 @@
      */
     public Xoroshiro128StarStar() {
         // 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));
     }
 
     /**
@@ -198,7 +199,7 @@
      */
     public Xoroshiro128StarStar(byte[] seed) {
         // Convert the seed to 2 long values, which are not both zero.
-        long[] data = RNGSupport.convertSeedBytesToLongs(seed, 2, 2);
+        long[] data = RandomSupport.convertSeedBytesToLongs(seed, 2, 2);
         long x0 = data[0], x1 = data[1];
         this.x0 = x0;
         this.x1 = x1;