diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2018-03-23 23:26:35 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2018-03-23 23:26:35 +0000 |
commit | b8f3fcca022295700464d59133e2d64db19476f4 (patch) | |
tree | e831d2e437fe64d293a12e87fbcaa8f3179580ca /src/test/java/com/healthmarketscience/jackcess | |
parent | 2cca13b956cbb56dc19f49c454ccee9b239059c5 (diff) | |
download | jackcess-b8f3fcca022295700464d59133e2d64db19476f4.tar.gz jackcess-b8f3fcca022295700464d59133e2d64db19476f4.zip |
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
Diffstat (limited to 'src/test/java/com/healthmarketscience/jackcess')
-rw-r--r-- | src/test/java/com/healthmarketscience/jackcess/impl/expr/ExpressionatorTest.java | 19 |
1 files changed, 3 insertions, 16 deletions
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); } } } |