@@ -28,6 +28,7 @@ public class ImpressionObserverTest {
2828 // We allow the cache implementation to have a 0.01% drift in size when elements change, given that it's internal
2929 // structure/references might vary, and the ObjectSizeCalculator is not 100% accurate
3030 private static final double SIZE_DELTA = 0.01 ;
31+ private final Random _rand = new Random ();
3132
3233 private List <KeyImpression > generateKeyImpressions (long count ) {
3334 ArrayList <KeyImpression > imps = new ArrayList <>();
@@ -100,13 +101,13 @@ public void testMemoryUsageStopsWhenCacheIsFull() throws Exception {
100101
101102
102103 private void caller (ImpressionObserver o , int count , ConcurrentLinkedQueue <KeyImpression > imps ) {
103- Random rand = new Random ();
104+
104105 while (count -- > 0 ) {
105106 KeyImpression k = new KeyImpression ();
106- k .keyName = "key_" + rand .nextInt (100 );
107- k .feature = "feature_" + rand .nextInt (10 );
108- k .label = "label" + rand .nextInt (5 );
109- k .treatment = rand .nextBoolean () ? "on" : "off" ;
107+ k .keyName = "key_" + _rand .nextInt (100 );
108+ k .feature = "feature_" + _rand .nextInt (10 );
109+ k .label = "label" + _rand .nextInt (5 );
110+ k .treatment = _rand .nextBoolean () ? "on" : "off" ;
110111 k .changeNumber = 1234567L ;
111112 k .time = System .currentTimeMillis ();
112113 k .pt = o .testAndSet (k );
0 commit comments