--- a/src/java.base/share/classes/java/util/random/Xoshiro256StarStar.java Thu Aug 29 11:33:26 2019 -0300
+++ b/src/java.base/share/classes/java/util/random/Xoshiro256StarStar.java Thu Nov 14 08:54:56 2019 -0400
@@ -233,8 +233,11 @@
* @return a pseudorandom {@code long} value
*/
public long nextLong() {
- final long z = x0;
- long q0 = x0, q1 = x1, q2 = x2, q3 = x3;
+ // Compute the result based on current state information
+ // (this allows the computation to be overlapped with state update).
+ final long result = Long.rotateLeft(x0 * 5, 7) * 9; // "starstar" mixing function
+
+ long q0 = x0, q1 = x1, q2 = x2, q3 = x3;
{ // xoshiro256 1.0
long t = q1 << 17;
q2 ^= q0;
@@ -245,7 +248,7 @@
q3 = Long.rotateLeft(q3, 45);
}
x0 = q0; x1 = q1; x2 = q2; x3 = q3;
- return Long.rotateLeft(z * 5, 7) * 9; // "starstar" mixing function
+ return result;
}
public BigInteger period() {