From b8f3fcca022295700464d59133e2d64db19476f4 Mon Sep 17 00:00:00 2001 From: James Ahlborn Date: Fri, 23 Mar 2018 23:26:35 +0000 Subject: move rnd logic to RandomContext git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/branches/exprs@1144 f203690c-595d-4dc9-a70b-905162fa7fd2 --- .../jackcess/impl/expr/ExpressionatorTest.java | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'src/test/java/com/healthmarketscience/jackcess') diff --git a/src/test/java/com/healthmarketscience/jackcess/impl/expr/ExpressionatorTest.java b/src/test/java/com/healthmarketscience/jackcess/impl/expr/ExpressionatorTest.java index c6bda5b..a3eb46a 100644 --- a/src/test/java/com/healthmarketscience/jackcess/impl/expr/ExpressionatorTest.java +++ b/src/test/java/com/healthmarketscience/jackcess/impl/expr/ExpressionatorTest.java @@ -19,7 +19,6 @@ package com.healthmarketscience.jackcess.impl.expr; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.Date; -import java.util.Random; import com.healthmarketscience.jackcess.DatabaseBuilder; import com.healthmarketscience.jackcess.TestUtil; @@ -382,9 +381,7 @@ public class ExpressionatorTest extends TestCase private static final class TestEvalContext implements EvalContext { private final Value _thisVal; - private Random _defRnd; - private Random _rnd; - private long _rndSeed; + private final RandomContext _rndCtx = new RandomContext(); private TestEvalContext(Value thisVal) { _thisVal = thisVal; @@ -416,18 +413,8 @@ public class ExpressionatorTest extends TestCase throw new UnsupportedOperationException(); } - public Random getRandom(Integer seed) { - if(seed == null) { - if(_defRnd == null) { - _defRnd = new Random(System.currentTimeMillis()); - } - return _defRnd; - } - if((_rnd == null) || (seed != _rndSeed)) { - _rndSeed = seed; - _rnd = new Random(_rndSeed); - } - return _rnd; + public float getRandom(Integer seed) { + return _rndCtx.getRandom(seed); } } } -- cgit v1.2.3