commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject [05/12] [math] MATH-1366
Date Tue, 17 May 2016 18:34:40 GMT
MATH-1366

Implementation of the RNG was moved to package "o.a.c.m.rng.internal.source32".


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/19ca67ad
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/19ca67ad
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/19ca67ad

Branch: refs/heads/task-MATH-1366
Commit: 19ca67ad410ab2cce8fc8d4dfd89c515ef23cc6c
Parents: aa3a018
Author: Gilles <erans@apache.org>
Authored: Tue May 17 19:28:47 2016 +0200
Committer: Gilles <erans@apache.org>
Committed: Tue May 17 19:28:47 2016 +0200

----------------------------------------------------------------------
 .../math4/random/JDKRandomGenerator.java        | 121 -------------------
 .../math4/random/JDKRandomGeneratorTest.java    |  26 ----
 2 files changed, 147 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/19ca67ad/src/main/java/org/apache/commons/math4/random/JDKRandomGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/JDKRandomGenerator.java b/src/main/java/org/apache/commons/math4/random/JDKRandomGenerator.java
deleted file mode 100644
index ddd399c..0000000
--- a/src/main/java/org/apache/commons/math4/random/JDKRandomGenerator.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.random;
-
-import java.util.Random;
-import org.apache.commons.math4.exception.NotStrictlyPositiveException;
-
-/**
- * A {@link RandomGenerator} adapter that delegates the random number
- * generation to the standard {@link java.util.Random} class.
- *
- * @since 1.1
- */
-public class JDKRandomGenerator
-    implements RandomGenerator {
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 20151227L;
-    /** JDK's RNG. */
-    private final Random delegate;
-
-    /**
-     * Creates an instance with an arbitrary seed.
-     */
-    public JDKRandomGenerator() {
-        delegate = new Random();
-    }
-
-    /**
-     * Creates an instance with the given seed.
-     *
-     * @param seed Initial seed.
-     * @since 3.6
-     */
-    public JDKRandomGenerator(long seed) {
-        delegate = new Random(seed);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setSeed(int seed) {
-        delegate.setSeed((long) seed);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setSeed(long seed) {
-        delegate.setSeed( seed);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setSeed(int[] seed) {
-        delegate.setSeed(RandomGeneratorFactory.convertToLong(seed));
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void nextBytes(byte[] bytes) {
-        delegate.nextBytes(bytes);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int nextInt() {
-        return delegate.nextInt();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public long nextLong() {
-        return delegate.nextLong();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public boolean nextBoolean() {
-        return delegate.nextBoolean();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public float nextFloat() {
-        return delegate.nextFloat();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double nextDouble() {
-        return delegate.nextDouble();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double nextGaussian() {
-        return delegate.nextGaussian();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int nextInt(int n) {
-        try {
-            return delegate.nextInt(n);
-        } catch (IllegalArgumentException e) {
-            throw new NotStrictlyPositiveException(n);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/19ca67ad/src/test/java/org/apache/commons/math4/random/JDKRandomGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/JDKRandomGeneratorTest.java b/src/test/java/org/apache/commons/math4/random/JDKRandomGeneratorTest.java
deleted file mode 100644
index 49d13c7..0000000
--- a/src/test/java/org/apache/commons/math4/random/JDKRandomGeneratorTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.random;
-
-public class JDKRandomGeneratorTest extends RandomGeneratorAbstractTest {
-
-    @Override
-    protected RandomGenerator makeGenerator() {
-        final long seed = 111;
-        return new JDKRandomGenerator(seed);
-    }
-}


Mime
View raw message