RepeatableRandom { public static <T> void shuffle(List<T> list) { instancedRepeatableRandom.shuffle(list); } private  RepeatableRandom(); static void initialiseWithSeed(long masterSeed); static void initialiseWithFixedValue(double fixedValue); static void clear(); static InstancedRepeatableRandom newInstance(); static double nextDouble(); static double nextDouble(double origin, double bound); static int nextInt(int bound); static boolean nextBoolean(); static UUID nextUUID(); static long nextLong(); static double nextGaussian(); static void shuffle(List<T> list); static void shuffle(T[] array); static T randomElementOf(Collection<T> collection); static T randomElementOf(List<T> list); static final double MIN_FIXED_VALUE; static final double MAX_FIXED_VALUE; }
@Test public void seededRandom_shufflesListDeterministically() { testFunctionDeterminism(() -> { List<Integer> mutableInput = Arrays.asList(1, 2, 3, 4, 5); RepeatableRandom.shuffle(mutableInput); return mutableInput; }, "shuffleLists"); }
@Test public void seededRandom_shufflesArrayDeterministically() { testFunctionDeterminism(() -> { Integer[] mutableInput = new Integer[]{1, 2, 3, 4, 5}; RepeatableRandom.shuffle(mutableInput); return Arrays.asList(mutableInput); }, "shuffleArrays"); }