Class SafeThreadLocalRandom

java.lang.Object
java.util.Random
com.palantir.random.SafeThreadLocalRandom
All Implemented Interfaces:
Serializable, RandomGenerator

public final class SafeThreadLocalRandom extends Random
An implementation of Random that delegates all methods to ThreadLocalRandom.current(). This class can be used as a drop in replacement for new Random(). Unlike ThreadLocalRandom, an instance of SafeThreadLocalRandom may be used by multiple threads because each method invocation delegates to ThreadLocalRandom.current(). Note that because this is a shared instance, Random.setSeed(long) is unsupported. This is not a SecureRandom instance and must not be used for cryptography.
See Also: