/** * Calculate a random value based on the previous value stored in this instance. * If you use this method in a concurring way, you need to synchronize the access! * @return */ public long random() { value = random(value); return value; }
@Override protected XorShiftRandom initialValue() { return new XorShiftRandom(seedRandom.nextLong()); } };
/** * We use the random generator for this very thread. * This method is perfectly threadsafe. It is also guaranteed * that each thread will get own values. */ @Override public long random() { return randomThreadLocal.get().random(); } }