src/java.base/share/classes/java/util/random/L128X256MixRandom.java
branchJDK-8193209-branch
changeset 57684 7cb325557832
parent 57547 56cbdc3ea079
child 59080 1b314be4feb2
--- a/src/java.base/share/classes/java/util/random/L128X256MixRandom.java	Wed Aug 07 15:35:55 2019 -0300
+++ b/src/java.base/share/classes/java/util/random/L128X256MixRandom.java	Thu Aug 08 11:06:54 2019 -0300
@@ -62,7 +62,7 @@
  * The LCG subgenerator for {@link L128X256MixRandom} has an update step of the
  * form {@code s = m * s + a}, where {@code s}, {@code m}, and {@code a} are all
  * 128-bit integers; {@code s} is the mutable state, the multiplier {@code m}
- * is fixed (the same for all instances of {@link L128X256MixRandom}}) and the addend
+ * is fixed (the same for all instances of {@link L128X256MixRandom}) and the addend
  * {@code a} is a parameter (a final field of the instance).  The parameter
  * {@code a} is required to be odd (this allows the LCG to have the maximal
  * period, namely 2<sup>128</sup>); therefore there are 2<sup>127</sup> distinct choices
@@ -309,7 +309,8 @@
     public L128X256MixRandom(byte[] seed) {
         // Convert the seed to 6 long values, of which the last 4 are not all zero.
         long[] data = RandomSupport.convertSeedBytesToLongs(seed, 6, 4);
-        long ah = data[0], al = data[1], sh = data[2], sl = data[3], x0 = data[4], x1 = data[5], x2 = data[6], x3 = data[7];
+        long ah = data[0], al = data[1], sh = data[2], sl = data[3],
+             x0 = data[4], x1 = data[5], x2 = data[6], x3 = data[7];
         // Force a to be odd.
         this.ah = ah;
         this.al = al | 1;
@@ -360,7 +361,15 @@
         sl = u + al;
         if (Long.compareUnsigned(sl, u) < 0) ++sh;  // Handle the carry propagation from low half to high half.
         long q0 = x0, q1 = x1, q2 = x2, q3 = x3;
-        { long t = q1 << 17; q2 ^= q0; q3 ^= q1; q1 ^= q2; q0 ^= q3; q2 ^= t; q3 = Long.rotateLeft(q3, 45); }  // xoshiro256 1.0
+        {   // xoshiro256 1.0
+            long t = q1 << 17;
+            q2 ^= q0;
+            q3 ^= q1;
+            q1 ^= q2;
+            q0 ^= q3;
+            q2 ^= t;
+            q3 = Long.rotateLeft(q3, 45);
+        }
         x0 = q0; x1 = q1; x2 = q2; x3 = q3;
         return RandomSupport.mixLea64(z);  // mixing function
     }