Usages of this class should typically be of the form: {@code ThreadLocalRandom.current().nextX(...)} (where{@code X} is {@code Int}, {@code Long}, etc). When all usages are of this form, it is never possible to accidently share a {@code ThreadLocalRandom} across multiple threads.
This class also provides additional commonly used bounded random generation methods.
Instances of {@code ThreadLocalRandom} are not cryptographicallysecure. Consider instead using {@link java.security.SecureRandom}in security-sensitive applications. Additionally, default-constructed instances do not use a cryptographically random seed unless the {@linkplain System#getProperty system property}{@code java.util.secureRandomSeed} is set to {@code true}. @since 1.7 @author Doug Lea
|
|
|
|
|
|