I know that Random
class generates insecure random sequences and I should prefer using SecureRandom
when dealing with security. But what about ThreadLocalRandom
? Is it more or less secure?
// generate a five-digit numeric confirmation code
Long code = ThreadLocalRandom.current().nextLong(1, 99999);