--- jsr166/src/test/loops/LoopHelpers.java 2009/11/02 23:42:46 1.8 +++ jsr166/src/test/loops/LoopHelpers.java 2015/01/15 18:34:19 1.14 @@ -1,15 +1,15 @@ /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain - */ -/** - * Misc utilities in JSR166 performance tests + * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.*; import java.util.concurrent.atomic.*; +/** + * Misc utilities in JSR166 performance tests + */ class LoopHelpers { static final SimpleRandom staticRNG = new SimpleRandom(); @@ -63,7 +63,6 @@ class LoopHelpers { return x * 134775813 + 1; } - /** * Yet another random number generator */ @@ -106,9 +105,9 @@ class LoopHelpers { public static final class XorShift32Random { static final AtomicInteger seq = new AtomicInteger(8862213); int x = -1831433054; - public XorShift32Random(int seed) { x = seed; } + public XorShift32Random(int seed) { x = seed; } public XorShift32Random() { - this((int)System.nanoTime() + seq.getAndAdd(129)); + this((int) System.nanoTime() + seq.getAndAdd(129)); } public int next() { x ^= x << 6; @@ -118,7 +117,6 @@ class LoopHelpers { } } - /** Multiplication-free RNG from Marsaglia "Xorshift RNGs" paper */ public static final class MarsagliaRandom { static final AtomicInteger seq = new AtomicInteger(3122688); @@ -128,7 +126,7 @@ class LoopHelpers { int w = 273326509; public MarsagliaRandom(int seed) { x = seed; } public MarsagliaRandom() { - this((int)System.nanoTime() + seq.getAndAdd(129)); + this((int) System.nanoTime() + seq.getAndAdd(129)); } public int next() { int t = x ^ (x << 11); @@ -143,9 +141,9 @@ class LoopHelpers { * Unsynchronized version of java.util.Random algorithm. */ public static final class SimpleRandom { - private final static long multiplier = 0x5DEECE66DL; - private final static long addend = 0xBL; - private final static long mask = (1L << 48) - 1; + private static final long multiplier = 0x5DEECE66DL; + private static final long addend = 0xBL; + private static final long mask = (1L << 48) - 1; static final AtomicLong seq = new AtomicLong( -715159705); private long seed; @@ -164,7 +162,7 @@ class LoopHelpers { public int next() { long nextseed = (seed * multiplier + addend) & mask; seed = nextseed; - return ((int)(nextseed >>> 17)) & 0x7FFFFFFF; + return ((int) (nextseed >>> 17)) & 0x7FFFFFFF; } }