diff --git a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/workload/GenerateDataWorkLoad.java b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/workload/GenerateDataWorkLoad.java index cf13f9d90..aa1ca9b4c 100644 --- a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/workload/GenerateDataWorkLoad.java +++ b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/workload/GenerateDataWorkLoad.java @@ -34,6 +34,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; +import java.util.concurrent.ThreadLocalRandom; public abstract class GenerateDataWorkLoad extends DataWorkLoad { @@ -43,7 +44,6 @@ public abstract class GenerateDataWorkLoad extends DataWorkLoad { private static final PoissonDistribution poissonDistribution = new PoissonDistribution(poissonRandom); private static final Random dataRandom = new Random(config.getDATA_SEED()); - private static final Random timestampRandom = new Random(config.getDATA_SEED()); private static final String CHAR_TABLE = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; private static final long timeStampConst = @@ -109,7 +109,7 @@ protected long getCurrentTimestamp(long stepOffset) throws WorkloadException { timestamp += config.getPOINT_STEP(); } else { // data is not in regular frequency, then use random - timestamp += config.getPOINT_STEP() * timestampRandom.nextDouble(); + timestamp += config.getPOINT_STEP() * ThreadLocalRandom.current().nextDouble(); } long currentTimestamp = Constants.START_TIMESTAMP * timeStampConst + offset + timestamp; if (config.isIS_RECENT_QUERY()) { @@ -129,7 +129,7 @@ private static long getCurrentTimestampStatic(long stepOffset) { timestamp += config.getPOINT_STEP(); } else { // data is not in regular frequency, then use random - timestamp += config.getPOINT_STEP() * timestampRandom.nextDouble(); + timestamp += config.getPOINT_STEP() * ThreadLocalRandom.current().nextDouble(); } return Constants.START_TIMESTAMP * timeStampConst + offset + timestamp; }