ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/SplittableRandom.java
(Generate patch)

Comparing jsr166/src/main/java/util/SplittableRandom.java (file contents):
Revision 1.36 by jsr166, Sun Nov 13 03:36:50 2016 UTC vs.
Revision 1.38 by jsr166, Tue Dec 20 22:08:05 2016 UTC

# Line 375 | Line 375 | public final class SplittableRandom {
375       * may, and typically does, vary across program invocations.
376       */
377      public SplittableRandom() { // emulate defaultGen.split()
378 <        long s = defaultGen.getAndAdd(2 * GOLDEN_GAMMA);
378 >        long s = defaultGen.getAndAdd(GOLDEN_GAMMA << 1);
379          this.seed = mix64(s);
380          this.gamma = mixGamma(s + GOLDEN_GAMMA);
381      }
# Line 531 | Line 531 | public final class SplittableRandom {
531      }
532  
533      /**
534     * Generates a pseudorandom number with the indicated number of
535     * low-order bits.  Because this class has no subclasses, this
536     * method cannot be invoked or overridden.
537     *
538     * @param  bits random bits
539     * @return the next pseudorandom value from this random number
540     *         generator's sequence
541     */
542    protected int next(int bits) {
543        return nextInt() >>> (32 - bits);
544    }
545
546    /**
534       * Returns a pseudorandom {@code double} value between the specified
535       * origin (inclusive) and bound (exclusive).
536       *

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines