Print this page


Split Close
Expand all
Collapse all
          --- old/test/java/util/concurrent/ConcurrentHashMap/LoopHelpers.java
          +++ new/test/java/util/concurrent/ConcurrentHashMap/LoopHelpers.java
↓ open down ↓ 71 lines elided ↑ open up ↑
  72   72              x = (x * 2147483647) % 16807;
  73   73          }
  74   74          return x;
  75   75      }
  76   76  
  77   77      /**
  78   78       * An actually useful random number generator, but unsynchronized.
  79   79       * Basically same as java.util.Random.
  80   80       */
  81   81      public static class SimpleRandom {
  82      -        private final static long multiplier = 0x5DEECE66DL;
  83      -        private final static long addend = 0xBL;
  84      -        private final static long mask = (1L << 48) - 1;
       82 +        private static final long multiplier = 0x5DEECE66DL;
       83 +        private static final long addend = 0xBL;
       84 +        private static final long mask = (1L << 48) - 1;
  85   85          static final AtomicLong seq = new AtomicLong(1);
  86   86          private long seed = System.nanoTime() + seq.getAndIncrement();
  87   87  
  88   88          public void setSeed(long s) {
  89   89              seed = s;
  90   90          }
  91   91  
  92   92          public int next() {
  93   93              long nextseed = (seed * multiplier + addend) & mask;
  94   94              seed = nextseed;
↓ open down ↓ 35 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX