mirror of
https://github.com/aljazceru/signal-cli.git
synced 2025-12-25 01:54:26 +01:00
Use lambda for ThreadLocal
This commit is contained in:
@@ -5,17 +5,14 @@ import java.security.SecureRandom;
|
||||
|
||||
public class RandomUtils {
|
||||
|
||||
private static final ThreadLocal<SecureRandom> LOCAL_RANDOM = new ThreadLocal<SecureRandom>() {
|
||||
@Override
|
||||
protected SecureRandom initialValue() {
|
||||
SecureRandom rand = getSecureRandomUnseeded();
|
||||
private static final ThreadLocal<SecureRandom> LOCAL_RANDOM = ThreadLocal.withInitial(() -> {
|
||||
SecureRandom rand = getSecureRandomUnseeded();
|
||||
|
||||
// Let the SecureRandom seed it self initially
|
||||
rand.nextBoolean();
|
||||
// Let the SecureRandom seed it self initially
|
||||
rand.nextBoolean();
|
||||
|
||||
return rand;
|
||||
}
|
||||
};
|
||||
return rand;
|
||||
});
|
||||
|
||||
private static SecureRandom getSecureRandomUnseeded() {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user