updated Random() to SecureRandom() (#1670)

* updated Random() to SecureRandom()

* batch 2 of SecureRandom updates
This commit is contained in:
Subhrodip Mohanta
2021-03-06 16:56:02 +05:30
committed by GitHub
parent c150871a94
commit b423002e6c
15 changed files with 32 additions and 31 deletions

View File

@ -23,8 +23,8 @@
package com.iluwatar.event.asynchronous;
import java.security.SecureRandom;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
/**
@ -43,7 +43,7 @@ public class EventManager implements ThreadCompleteListener {
public static final int MAX_ID = MAX_RUNNING_EVENTS;
public static final int MAX_EVENT_TIME = 1800; // in seconds / 30 minutes.
private int currentlyRunningSyncEvent = -1;
private final Random rand;
private final SecureRandom rand;
private final Map<Integer, Event> eventPool;
private static final String DOES_NOT_EXIST = " does not exist.";
@ -52,7 +52,7 @@ public class EventManager implements ThreadCompleteListener {
* EventManager constructor.
*/
public EventManager() {
rand = new Random(1);
rand = new SecureRandom();
eventPool = new ConcurrentHashMap<Integer, Event>(MAX_RUNNING_EVENTS);
}