Package io.pravega.common.hash
Class RandomFactory
- java.lang.Object
-
- io.pravega.common.hash.RandomFactory
-
public class RandomFactory extends java.lang.ObjectActs as a constructor for java.util.Random objects. This avoids the anti-pattern ofint randomInt = new Random().nextInt();Which is not really random because the default seed is the current time. So this class provides the seed automatically from a master random number generator.
-
-
Constructor Summary
Constructors Constructor Description RandomFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Randomcreate()Returns a new random number generator.static longgetSeed()Returns a good seed for a random number generator.
-