Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D0FD32009A8 for ; Tue, 17 May 2016 20:34:38 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CFB24160A22; Tue, 17 May 2016 18:34:38 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 075641609F5 for ; Tue, 17 May 2016 20:34:37 +0200 (CEST) Received: (qmail 12319 invoked by uid 500); 17 May 2016 18:34:37 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 12294 invoked by uid 99); 17 May 2016 18:34:36 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 May 2016 18:34:36 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id AEB69E01BD; Tue, 17 May 2016 18:34:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: erans@apache.org To: commits@commons.apache.org Date: Tue, 17 May 2016 18:34:40 -0000 Message-Id: <04999146bcd249bcb4f65e1618be538a@git.apache.org> In-Reply-To: <2642405040e049958d25c0f45a98fc85@git.apache.org> References: <2642405040e049958d25c0f45a98fc85@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [05/12] [math] MATH-1366 archived-at: Tue, 17 May 2016 18:34:39 -0000 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 Authored: Tue May 17 19:28:47 2016 +0200 Committer: Gilles 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); - } -}