Now it is easy to use RandomGenerator (JDK17) and SplittableRandom (JDK8).
Example:
// use a random function that returns a long value
RandomGenerator random = RandomGenerator.getDefault();
RandomBasedFactory factory = new RandomBasedFactory(() -> random.nextLong());
Now it is easy to use
RandomGenerator
(JDK17) andSplittableRandom
(JDK8).Example: