mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Remove references to Random from production code, closes https://github.com/OpenHFT/Chronicle-Core/issues/218
This commit is contained in:
@@ -6,7 +6,7 @@ import net.openhft.chronicle.threads.NamedThreadFactory;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.Random;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.IntStream;
|
||||
@@ -105,7 +105,7 @@ public class MapStress {
|
||||
long written = 0;
|
||||
do {
|
||||
long time = System.currentTimeMillis();
|
||||
final Random random = ThreadLocalRandom.current();
|
||||
final SecureRandom random = new SecureRandom();
|
||||
IntStream.range(0, 10).forEach(x -> {
|
||||
final int keyIdx = random.nextInt(N_WRITE_THREADS * 100);
|
||||
Security sec = secs[x % 5];
|
||||
|
||||
@@ -23,8 +23,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.LockSupport;
|
||||
import java.util.function.Predicate;
|
||||
@@ -95,7 +94,7 @@ class OldDeletedEntriesCleanupThread extends Thread
|
||||
|
||||
// Implementing Fisher–Yates shuffle
|
||||
private static void shuffle(int[] a) {
|
||||
Random rnd = ThreadLocalRandom.current();
|
||||
SecureRandom rnd = new SecureRandom();
|
||||
for (int i = a.length - 1; i > 0; i--) {
|
||||
int index = rnd.nextInt(i + 1);
|
||||
int e = a[index];
|
||||
|
||||
Reference in New Issue
Block a user