/** Push a new randomness on top of the stack. */ void push(Randomness rnd) { getPerThread().randomnesses.push(rnd); }
/** Push a new randomness on top of the stack. */ void push(Randomness rnd) { getPerThread().randomnesses.push(rnd); }
/** Source of randomness for the context's thread. */ public Randomness getRandomness() { return getPerThread().randomnesses.peekFirst(); }
/** Pop a randomness off the stack and dispose it. */ void popAndDestroy() { getPerThread().randomnesses.pop().destroy(); }
/** Pop a randomness off the stack and dispose it. */ void popAndDestroy() { getPerThread().randomnesses.pop().destroy(); }
/** * Return all {@link Randomness} on the stack for the current thread. The most * recent (currently used) randomness comes last in this array. */ Randomness [] getRandomnesses() { ArrayDeque<Randomness> randomnesses = getPerThread().randomnesses; Randomness[] array = randomnesses.toArray(new Randomness [randomnesses.size()]); for (int i = 0, j = array.length - 1; i < j; i++, j--) { Randomness r = array[i]; array[i] = array[j]; array[j] = r; } return array; }
/** Source of randomness for the context's thread. */ public Randomness getRandomness() { return getPerThread().randomnesses.peekFirst(); }
/** * Return all {@link Randomness} on the stack for the current thread. The most * recent (currently used) randomness comes last in this array. */ Randomness [] getRandomnesses() { ArrayDeque<Randomness> randomnesses = getPerThread().randomnesses; Randomness[] array = randomnesses.toArray(new Randomness [randomnesses.size()]); for (int i = 0, j = array.length - 1; i < j; i++, j--) { Randomness r = array[i]; array[i] = array[j]; array[j] = r; } return array; }