diff --git a/pom.xml b/pom.xml index da4b69bb5..d0fed34d2 100644 --- a/pom.xml +++ b/pom.xml @@ -360,6 +360,12 @@ + + org.apache.commons + commons-rng + 1.0-SNAPSHOT + + junit junit diff --git a/src/main/java/org/apache/commons/math4/distribution/AbstractIntegerDistribution.java b/src/main/java/org/apache/commons/math4/distribution/AbstractIntegerDistribution.java index 0bc377d74..f502e0cdf 100644 --- a/src/main/java/org/apache/commons/math4/distribution/AbstractIntegerDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/AbstractIntegerDistribution.java @@ -22,7 +22,7 @@ import org.apache.commons.math4.exception.MathInternalError; import org.apache.commons.math4.exception.NumberIsTooLargeException; import org.apache.commons.math4.exception.OutOfRangeException; import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.util.FastMath; /** diff --git a/src/main/java/org/apache/commons/math4/distribution/AbstractMultivariateRealDistribution.java b/src/main/java/org/apache/commons/math4/distribution/AbstractMultivariateRealDistribution.java index 1c4adef05..f48d188b4 100644 --- a/src/main/java/org/apache/commons/math4/distribution/AbstractMultivariateRealDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/AbstractMultivariateRealDistribution.java @@ -18,7 +18,7 @@ package org.apache.commons.math4.distribution; import org.apache.commons.math4.exception.NotStrictlyPositiveException; import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; /** * Base class for multivariate probability distributions. diff --git a/src/main/java/org/apache/commons/math4/distribution/AbstractRealDistribution.java b/src/main/java/org/apache/commons/math4/distribution/AbstractRealDistribution.java index 057dd8ad7..f874f1625 100644 --- a/src/main/java/org/apache/commons/math4/distribution/AbstractRealDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/AbstractRealDistribution.java @@ -23,7 +23,7 @@ import org.apache.commons.math4.analysis.solvers.UnivariateSolverUtils; import org.apache.commons.math4.exception.NumberIsTooLargeException; import org.apache.commons.math4.exception.OutOfRangeException; import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.util.FastMath; /** diff --git a/src/main/java/org/apache/commons/math4/distribution/BetaDistribution.java b/src/main/java/org/apache/commons/math4/distribution/BetaDistribution.java index abccb9304..31a1d30bf 100644 --- a/src/main/java/org/apache/commons/math4/distribution/BetaDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/BetaDistribution.java @@ -18,7 +18,7 @@ package org.apache.commons.math4.distribution; import org.apache.commons.math4.exception.NumberIsTooSmallException; import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.special.Beta; import org.apache.commons.math4.special.Gamma; import org.apache.commons.math4.util.FastMath; diff --git a/src/main/java/org/apache/commons/math4/distribution/ConstantRealDistribution.java b/src/main/java/org/apache/commons/math4/distribution/ConstantRealDistribution.java index a34179a41..b699e0304 100644 --- a/src/main/java/org/apache/commons/math4/distribution/ConstantRealDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/ConstantRealDistribution.java @@ -18,7 +18,7 @@ package org.apache.commons.math4.distribution; import org.apache.commons.math4.exception.OutOfRangeException; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; /** * Implementation of the constant real distribution. diff --git a/src/main/java/org/apache/commons/math4/distribution/EmpiricalDistribution.java b/src/main/java/org/apache/commons/math4/distribution/EmpiricalDistribution.java index f898d95a2..51444b74c 100644 --- a/src/main/java/org/apache/commons/math4/distribution/EmpiricalDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/EmpiricalDistribution.java @@ -37,7 +37,7 @@ import org.apache.commons.math4.exception.NotStrictlyPositiveException; import org.apache.commons.math4.exception.util.LocalizedFormats; import org.apache.commons.math4.stat.descriptive.StatisticalSummary; import org.apache.commons.math4.stat.descriptive.SummaryStatistics; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.util.FastMath; import org.apache.commons.math4.util.MathUtils; diff --git a/src/main/java/org/apache/commons/math4/distribution/EnumeratedDistribution.java b/src/main/java/org/apache/commons/math4/distribution/EnumeratedDistribution.java index 88ce03782..bfcd1af05 100644 --- a/src/main/java/org/apache/commons/math4/distribution/EnumeratedDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/EnumeratedDistribution.java @@ -29,7 +29,7 @@ import org.apache.commons.math4.exception.NotPositiveException; import org.apache.commons.math4.exception.NotStrictlyPositiveException; import org.apache.commons.math4.exception.NullArgumentException; import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.util.MathArrays; import org.apache.commons.math4.util.Pair; diff --git a/src/main/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistribution.java b/src/main/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistribution.java index e8f3ed636..110e40804 100644 --- a/src/main/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistribution.java @@ -27,7 +27,7 @@ import org.apache.commons.math4.exception.MathArithmeticException; import org.apache.commons.math4.exception.NotANumberException; import org.apache.commons.math4.exception.NotFiniteNumberException; import org.apache.commons.math4.exception.NotPositiveException; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.util.Pair; /** diff --git a/src/main/java/org/apache/commons/math4/distribution/EnumeratedRealDistribution.java b/src/main/java/org/apache/commons/math4/distribution/EnumeratedRealDistribution.java index 0e34f5a8f..b21b994dc 100644 --- a/src/main/java/org/apache/commons/math4/distribution/EnumeratedRealDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/EnumeratedRealDistribution.java @@ -28,7 +28,7 @@ import org.apache.commons.math4.exception.NotANumberException; import org.apache.commons.math4.exception.NotFiniteNumberException; import org.apache.commons.math4.exception.NotPositiveException; import org.apache.commons.math4.exception.OutOfRangeException; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.util.Pair; /** diff --git a/src/main/java/org/apache/commons/math4/distribution/ExponentialDistribution.java b/src/main/java/org/apache/commons/math4/distribution/ExponentialDistribution.java index 9527aa00b..fb4453627 100644 --- a/src/main/java/org/apache/commons/math4/distribution/ExponentialDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/ExponentialDistribution.java @@ -19,7 +19,7 @@ package org.apache.commons.math4.distribution; import org.apache.commons.math4.exception.NotStrictlyPositiveException; import org.apache.commons.math4.exception.OutOfRangeException; import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.util.CombinatoricsUtils; import org.apache.commons.math4.util.FastMath; import org.apache.commons.math4.util.ResizableDoubleArray; diff --git a/src/main/java/org/apache/commons/math4/distribution/GammaDistribution.java b/src/main/java/org/apache/commons/math4/distribution/GammaDistribution.java index 413493f31..a1d2d87a9 100644 --- a/src/main/java/org/apache/commons/math4/distribution/GammaDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/GammaDistribution.java @@ -18,7 +18,7 @@ package org.apache.commons.math4.distribution; import org.apache.commons.math4.exception.NotStrictlyPositiveException; import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.special.Gamma; import org.apache.commons.math4.util.FastMath; diff --git a/src/main/java/org/apache/commons/math4/distribution/IntegerDistribution.java b/src/main/java/org/apache/commons/math4/distribution/IntegerDistribution.java index aed97aba2..05076ae7c 100644 --- a/src/main/java/org/apache/commons/math4/distribution/IntegerDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/IntegerDistribution.java @@ -18,7 +18,7 @@ package org.apache.commons.math4.distribution; import org.apache.commons.math4.exception.NumberIsTooLargeException; import org.apache.commons.math4.exception.OutOfRangeException; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; /** * Interface for distributions on the integers. diff --git a/src/main/java/org/apache/commons/math4/distribution/LogNormalDistribution.java b/src/main/java/org/apache/commons/math4/distribution/LogNormalDistribution.java index 6b155d51e..d8a022901 100644 --- a/src/main/java/org/apache/commons/math4/distribution/LogNormalDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/LogNormalDistribution.java @@ -20,7 +20,7 @@ package org.apache.commons.math4.distribution; import org.apache.commons.math4.exception.NotStrictlyPositiveException; import org.apache.commons.math4.exception.NumberIsTooLargeException; import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.special.Erf; import org.apache.commons.math4.util.FastMath; diff --git a/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateRealDistribution.java b/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateRealDistribution.java index 4caee3f2b..893c543ba 100644 --- a/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateRealDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateRealDistribution.java @@ -23,7 +23,7 @@ import org.apache.commons.math4.exception.DimensionMismatchException; import org.apache.commons.math4.exception.MathArithmeticException; import org.apache.commons.math4.exception.NotPositiveException; import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.util.Pair; /** diff --git a/src/main/java/org/apache/commons/math4/distribution/MultivariateNormalDistribution.java b/src/main/java/org/apache/commons/math4/distribution/MultivariateNormalDistribution.java index da270ad2b..097caa044 100644 --- a/src/main/java/org/apache/commons/math4/distribution/MultivariateNormalDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/MultivariateNormalDistribution.java @@ -22,7 +22,7 @@ import org.apache.commons.math4.linear.EigenDecomposition; import org.apache.commons.math4.linear.NonPositiveDefiniteMatrixException; import org.apache.commons.math4.linear.RealMatrix; import org.apache.commons.math4.linear.SingularMatrixException; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.util.FastMath; import org.apache.commons.math4.util.MathArrays; diff --git a/src/main/java/org/apache/commons/math4/distribution/MultivariateRealDistribution.java b/src/main/java/org/apache/commons/math4/distribution/MultivariateRealDistribution.java index c299684fa..ef5fca98d 100644 --- a/src/main/java/org/apache/commons/math4/distribution/MultivariateRealDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/MultivariateRealDistribution.java @@ -16,7 +16,7 @@ */ package org.apache.commons.math4.distribution; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; /** * Base interface for multivariate distributions on the reals. diff --git a/src/main/java/org/apache/commons/math4/distribution/NormalDistribution.java b/src/main/java/org/apache/commons/math4/distribution/NormalDistribution.java index b8e919b1f..d971eb6e3 100644 --- a/src/main/java/org/apache/commons/math4/distribution/NormalDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/NormalDistribution.java @@ -21,7 +21,7 @@ import org.apache.commons.math4.exception.NotStrictlyPositiveException; import org.apache.commons.math4.exception.NumberIsTooLargeException; import org.apache.commons.math4.exception.OutOfRangeException; import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.special.Erf; import org.apache.commons.math4.util.FastMath; diff --git a/src/main/java/org/apache/commons/math4/distribution/ParetoDistribution.java b/src/main/java/org/apache/commons/math4/distribution/ParetoDistribution.java index 04427dacb..b7c405fd1 100644 --- a/src/main/java/org/apache/commons/math4/distribution/ParetoDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/ParetoDistribution.java @@ -19,7 +19,7 @@ package org.apache.commons.math4.distribution; import org.apache.commons.math4.exception.NotStrictlyPositiveException; import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.util.FastMath; /** diff --git a/src/main/java/org/apache/commons/math4/distribution/PoissonDistribution.java b/src/main/java/org/apache/commons/math4/distribution/PoissonDistribution.java index 49a08dae3..1c7b8dbf1 100644 --- a/src/main/java/org/apache/commons/math4/distribution/PoissonDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/PoissonDistribution.java @@ -22,7 +22,7 @@ import org.apache.commons.math4.special.Gamma; import org.apache.commons.math4.util.CombinatoricsUtils; import org.apache.commons.math4.util.FastMath; import org.apache.commons.math4.util.MathUtils; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; /** * Implementation of the Poisson distribution. diff --git a/src/main/java/org/apache/commons/math4/distribution/RealDistribution.java b/src/main/java/org/apache/commons/math4/distribution/RealDistribution.java index 7ddc1fd22..a9e8cb22c 100644 --- a/src/main/java/org/apache/commons/math4/distribution/RealDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/RealDistribution.java @@ -18,7 +18,7 @@ package org.apache.commons.math4.distribution; import org.apache.commons.math4.exception.NumberIsTooLargeException; import org.apache.commons.math4.exception.OutOfRangeException; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; /** * Base interface for distributions on the reals. diff --git a/src/main/java/org/apache/commons/math4/distribution/UniformIntegerDistribution.java b/src/main/java/org/apache/commons/math4/distribution/UniformIntegerDistribution.java index d1489d30f..1e89c4309 100644 --- a/src/main/java/org/apache/commons/math4/distribution/UniformIntegerDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/UniformIntegerDistribution.java @@ -19,7 +19,7 @@ package org.apache.commons.math4.distribution; import org.apache.commons.math4.exception.NumberIsTooLargeException; import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; /** * Implementation of the uniform integer distribution. diff --git a/src/main/java/org/apache/commons/math4/distribution/UniformRealDistribution.java b/src/main/java/org/apache/commons/math4/distribution/UniformRealDistribution.java index a7a1c4d9e..343bee07a 100644 --- a/src/main/java/org/apache/commons/math4/distribution/UniformRealDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/UniformRealDistribution.java @@ -20,7 +20,7 @@ package org.apache.commons.math4.distribution; import org.apache.commons.math4.exception.NumberIsTooLargeException; import org.apache.commons.math4.exception.OutOfRangeException; import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; /** * Implementation of the uniform real distribution. diff --git a/src/main/java/org/apache/commons/math4/distribution/ZipfDistribution.java b/src/main/java/org/apache/commons/math4/distribution/ZipfDistribution.java index 82e9fb3bf..3ea152cb2 100644 --- a/src/main/java/org/apache/commons/math4/distribution/ZipfDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/ZipfDistribution.java @@ -19,7 +19,7 @@ package org.apache.commons.math4.distribution; import org.apache.commons.math4.exception.NotStrictlyPositiveException; import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.util.FastMath; /** diff --git a/src/main/java/org/apache/commons/math4/genetics/GeneticAlgorithm.java b/src/main/java/org/apache/commons/math4/genetics/GeneticAlgorithm.java index d76fe9399..b43bf52ef 100644 --- a/src/main/java/org/apache/commons/math4/genetics/GeneticAlgorithm.java +++ b/src/main/java/org/apache/commons/math4/genetics/GeneticAlgorithm.java @@ -18,8 +18,8 @@ package org.apache.commons.math4.genetics; import org.apache.commons.math4.exception.OutOfRangeException; import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.rng.RandomSource; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.RandomSource; +import org.apache.commons.rng.UniformRandomProvider; /** * Implementation of a genetic algorithm. All factors that govern the operation diff --git a/src/main/java/org/apache/commons/math4/genetics/NPointCrossover.java b/src/main/java/org/apache/commons/math4/genetics/NPointCrossover.java index 847e9bca5..6a497ab2f 100644 --- a/src/main/java/org/apache/commons/math4/genetics/NPointCrossover.java +++ b/src/main/java/org/apache/commons/math4/genetics/NPointCrossover.java @@ -24,7 +24,7 @@ import org.apache.commons.math4.exception.MathIllegalArgumentException; import org.apache.commons.math4.exception.NotStrictlyPositiveException; import org.apache.commons.math4.exception.NumberIsTooLargeException; import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; /** * N-point crossover policy. For each iteration a random crossover point is diff --git a/src/main/java/org/apache/commons/math4/genetics/OrderedCrossover.java b/src/main/java/org/apache/commons/math4/genetics/OrderedCrossover.java index 6b6502cf2..a1e777211 100644 --- a/src/main/java/org/apache/commons/math4/genetics/OrderedCrossover.java +++ b/src/main/java/org/apache/commons/math4/genetics/OrderedCrossover.java @@ -25,7 +25,7 @@ import java.util.Set; import org.apache.commons.math4.exception.DimensionMismatchException; import org.apache.commons.math4.exception.MathIllegalArgumentException; import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.util.FastMath; /** diff --git a/src/main/java/org/apache/commons/math4/genetics/UniformCrossover.java b/src/main/java/org/apache/commons/math4/genetics/UniformCrossover.java index df5b929b4..74fac3ddc 100644 --- a/src/main/java/org/apache/commons/math4/genetics/UniformCrossover.java +++ b/src/main/java/org/apache/commons/math4/genetics/UniformCrossover.java @@ -23,7 +23,7 @@ import org.apache.commons.math4.exception.DimensionMismatchException; import org.apache.commons.math4.exception.MathIllegalArgumentException; import org.apache.commons.math4.exception.OutOfRangeException; import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; /** * Perform Uniform Crossover [UX] on the specified chromosomes. A fixed mixing diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClusterer.java b/src/main/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClusterer.java index f650d2406..cb6f0114a 100644 --- a/src/main/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClusterer.java +++ b/src/main/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClusterer.java @@ -28,8 +28,8 @@ import org.apache.commons.math4.linear.MatrixUtils; import org.apache.commons.math4.linear.RealMatrix; import org.apache.commons.math4.ml.distance.DistanceMeasure; import org.apache.commons.math4.ml.distance.EuclideanDistance; -import org.apache.commons.math4.rng.RandomSource; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.RandomSource; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.util.FastMath; import org.apache.commons.math4.util.MathArrays; import org.apache.commons.math4.util.MathUtils; diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClusterer.java b/src/main/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClusterer.java index 0b8ad96fa..e0eeac460 100644 --- a/src/main/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClusterer.java +++ b/src/main/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClusterer.java @@ -28,8 +28,8 @@ import org.apache.commons.math4.exception.NumberIsTooSmallException; import org.apache.commons.math4.exception.util.LocalizedFormats; import org.apache.commons.math4.ml.distance.DistanceMeasure; import org.apache.commons.math4.ml.distance.EuclideanDistance; -import org.apache.commons.math4.rng.RandomSource; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.RandomSource; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.stat.descriptive.moment.Variance; import org.apache.commons.math4.util.MathUtils; diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/FeatureInitializerFactory.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/FeatureInitializerFactory.java index 9c36dd394..9ab532ccc 100644 --- a/src/main/java/org/apache/commons/math4/ml/neuralnet/FeatureInitializerFactory.java +++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/FeatureInitializerFactory.java @@ -21,8 +21,8 @@ import org.apache.commons.math4.analysis.UnivariateFunction; import org.apache.commons.math4.analysis.function.Constant; import org.apache.commons.math4.distribution.RealDistribution; import org.apache.commons.math4.distribution.UniformRealDistribution; -import org.apache.commons.math4.rng.RandomSource; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.RandomSource; +import org.apache.commons.rng.UniformRandomProvider; /** * Creates functions that will select the initial values of a neuron's diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizer.java index 8fe9afe69..6eb2eccd5 100644 --- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizer.java +++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizer.java @@ -35,7 +35,7 @@ import org.apache.commons.math4.optim.OptimizationData; import org.apache.commons.math4.optim.PointValuePair; import org.apache.commons.math4.optim.nonlinear.scalar.GoalType; import org.apache.commons.math4.optim.nonlinear.scalar.MultivariateOptimizer; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.distribution.RealDistribution; import org.apache.commons.math4.distribution.NormalDistribution; import org.apache.commons.math4.util.FastMath; diff --git a/src/main/java/org/apache/commons/math4/optim/univariate/MultiStartUnivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optim/univariate/MultiStartUnivariateOptimizer.java index 65bfa6776..373a3078d 100644 --- a/src/main/java/org/apache/commons/math4/optim/univariate/MultiStartUnivariateOptimizer.java +++ b/src/main/java/org/apache/commons/math4/optim/univariate/MultiStartUnivariateOptimizer.java @@ -26,7 +26,7 @@ import org.apache.commons.math4.exception.util.LocalizedFormats; import org.apache.commons.math4.optim.MaxEval; import org.apache.commons.math4.optim.OptimizationData; import org.apache.commons.math4.optim.nonlinear.scalar.GoalType; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; /** * Special implementation of the {@link UnivariateOptimizer} interface diff --git a/src/main/java/org/apache/commons/math4/random/GaussianRandomGenerator.java b/src/main/java/org/apache/commons/math4/random/GaussianRandomGenerator.java index c70a7dfdc..fc7f98cc2 100644 --- a/src/main/java/org/apache/commons/math4/random/GaussianRandomGenerator.java +++ b/src/main/java/org/apache/commons/math4/random/GaussianRandomGenerator.java @@ -17,7 +17,7 @@ package org.apache.commons.math4.random; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.distribution.RealDistribution; import org.apache.commons.math4.distribution.NormalDistribution; diff --git a/src/main/java/org/apache/commons/math4/random/JDKRandomAdaptor.java b/src/main/java/org/apache/commons/math4/random/JDKRandomAdaptor.java index f3ab22eb3..f92d4354b 100644 --- a/src/main/java/org/apache/commons/math4/random/JDKRandomAdaptor.java +++ b/src/main/java/org/apache/commons/math4/random/JDKRandomAdaptor.java @@ -21,7 +21,7 @@ import java.io.ObjectOutputStream; import java.io.IOException; import org.apache.commons.math4.exception.MathInternalError; import org.apache.commons.math4.exception.MathUnsupportedOperationException; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.distribution.RealDistribution; import org.apache.commons.math4.distribution.NormalDistribution; diff --git a/src/main/java/org/apache/commons/math4/random/RandomGenerator.java b/src/main/java/org/apache/commons/math4/random/RandomGenerator.java index 49842ce20..c698f85c5 100644 --- a/src/main/java/org/apache/commons/math4/random/RandomGenerator.java +++ b/src/main/java/org/apache/commons/math4/random/RandomGenerator.java @@ -21,7 +21,7 @@ package org.apache.commons.math4.random; * Interface extracted from java.util.Random. * * @since 1.1 - * @deprecated As of 4.0. Please use {@link org.apache.commons.math4.rng.UniformRandomProvider} instead. + * @deprecated As of 4.0. Please use {@link org.apache.commons.rng.UniformRandomProvider} instead. */ @Deprecated public interface RandomGenerator { diff --git a/src/main/java/org/apache/commons/math4/random/RandomUtils.java b/src/main/java/org/apache/commons/math4/random/RandomUtils.java index 610b3203e..5af7cbb59 100644 --- a/src/main/java/org/apache/commons/math4/random/RandomUtils.java +++ b/src/main/java/org/apache/commons/math4/random/RandomUtils.java @@ -29,7 +29,7 @@ import org.apache.commons.math4.exception.NotFiniteNumberException; import org.apache.commons.math4.exception.NotStrictlyPositiveException; import org.apache.commons.math4.exception.NumberIsTooLargeException; import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.util.MathArrays; /** diff --git a/src/main/java/org/apache/commons/math4/random/RngAdaptor.java b/src/main/java/org/apache/commons/math4/random/RngAdaptor.java index d132c9576..5a24fec24 100644 --- a/src/main/java/org/apache/commons/math4/random/RngAdaptor.java +++ b/src/main/java/org/apache/commons/math4/random/RngAdaptor.java @@ -21,8 +21,8 @@ import java.io.IOException; import java.io.ObjectOutputStream; import java.io.ObjectInputStream; import org.apache.commons.math4.util.FastMath; -import org.apache.commons.math4.rng.UniformRandomProvider; -import org.apache.commons.math4.rng.RandomSource; +import org.apache.commons.rng.UniformRandomProvider; +import org.apache.commons.rng.RandomSource; /** * Adaptor that delegates to a {@link UniformRandomProvider} instance. diff --git a/src/main/java/org/apache/commons/math4/random/StableRandomGenerator.java b/src/main/java/org/apache/commons/math4/random/StableRandomGenerator.java index 3199c0ffa..f3a851b9b 100644 --- a/src/main/java/org/apache/commons/math4/random/StableRandomGenerator.java +++ b/src/main/java/org/apache/commons/math4/random/StableRandomGenerator.java @@ -16,7 +16,7 @@ */ package org.apache.commons.math4.random; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.exception.NullArgumentException; import org.apache.commons.math4.exception.OutOfRangeException; import org.apache.commons.math4.exception.util.LocalizedFormats; diff --git a/src/main/java/org/apache/commons/math4/random/UniformRandomGenerator.java b/src/main/java/org/apache/commons/math4/random/UniformRandomGenerator.java index 1a07ba4f3..d43c6d9d7 100644 --- a/src/main/java/org/apache/commons/math4/random/UniformRandomGenerator.java +++ b/src/main/java/org/apache/commons/math4/random/UniformRandomGenerator.java @@ -18,7 +18,7 @@ package org.apache.commons.math4.random; import org.apache.commons.math4.util.FastMath; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.UniformRandomProvider; /** * This class implements a normalized uniform random generator. diff --git a/src/main/java/org/apache/commons/math4/random/UnitSphereRandomVectorGenerator.java b/src/main/java/org/apache/commons/math4/random/UnitSphereRandomVectorGenerator.java index 33993f5ca..19a64d647 100644 --- a/src/main/java/org/apache/commons/math4/random/UnitSphereRandomVectorGenerator.java +++ b/src/main/java/org/apache/commons/math4/random/UnitSphereRandomVectorGenerator.java @@ -17,8 +17,8 @@ package org.apache.commons.math4.random; -import org.apache.commons.math4.rng.RandomSource; -import org.apache.commons.math4.rng.UniformRandomProvider; +import org.apache.commons.rng.RandomSource; +import org.apache.commons.rng.UniformRandomProvider; import org.apache.commons.math4.distribution.RealDistribution; import org.apache.commons.math4.distribution.NormalDistribution; import org.apache.commons.math4.util.FastMath; diff --git a/src/main/java/org/apache/commons/math4/rng/RandomSource.java b/src/main/java/org/apache/commons/math4/rng/RandomSource.java deleted file mode 100644 index fee11a36b..000000000 --- a/src/main/java/org/apache/commons/math4/rng/RandomSource.java +++ /dev/null @@ -1,418 +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.rng; - -import org.apache.commons.math4.exception.MathUnsupportedOperationException; -import org.apache.commons.math4.rng.internal.ProviderBuilder; -import org.apache.commons.math4.rng.internal.BaseProvider; -import org.apache.commons.math4.rng.internal.util.SeedFactory; -import org.apache.commons.math4.rng.internal.source64.TwoCmres; - -/** - * This class provides the API for creating generators of random numbers. - *

- * Usage examples: - *


- *  UniformRandomProvider rng = RandomSource.create(RandomSource.MT);
- * 
- * or - *

- *  final int[] seed = new int[] { 196, 9, 0, 226 };
- *  UniformRandomProvider rng = RandomSource.create(RandomSource.MT, seed);
- * 
- * or - *

- *  final int[] seed = RandomSource.createIntArray(256);
- *  UniformRandomProvider rng = RandomSource.create(RandomSource.MT, seed);
- * 
- * where the first argument to method {@code create} is the identifier - * of the generator's concrete implementation, and the second the is the - * (optional) seed. - *
- * In the first form, a random seed will be {@link SeedFactory generated - * automatically}; in the second form, a fixed seed is used; a random seed - * is explicitly generated in the third form. - *

- * - *

- * Seeding is the procedure by which a value (or set of values) is - * used to initialize a generator instance. - * The requirement that a given seed will always result in the same - * internal state allows to create different instances of a generator - * that will produce the same sequence of pseudo-random numbers. - *

- * - *

- * The type of data used as a seed depends on the concrete implementation - * as some types may not provide enough information to fully initialize - * the generator's internal state. - *
- * The reference algorithm's seeding procedure (if provided) operates - * on a value of a (single) native type: - * Each concrete implementation's constructor creates an instance using - * the native type whose information contents is used to set the - * internal state. - *
- * When the seed value passed by the caller is of the native type, it is - * expected that the sequences produced will be identical to those - * produced by other implementations of the same reference algorithm. - *
- * However, when the seed value passed by the caller is not of the native - * type, a transformation is performed by this library and the resulting - * native type value will not contain more information than the - * original seed value. - * If the algorithm's native type is "simpler" than the type passed by - * the caller, then some (unused) information will even be lost. - *
- * The transformation from non-native to native seed type is arbitrary, - * as long as it does not reduce the amount of information required by - * the algorithm to initialize its state. - * The consequence of the transformation is that sequences produced - * by this library may not be the same as the sequences produced - * by other implementations of the same algorithm! - *

- * - *

- * This class provides methods to generate random seeds (single values - * or arrays of values, of {@code int} or {@code long} types) that can - * be passed to the {@link RandomSource#create(RandomSource,Object,Object[]) - * generators factory method}. - *
- * Although the seed-generating methods defined in this class will likely - * return different values each time they are called, there is no guarantee - * that the resulting "seed" will always generate a good (i.e. - * sufficiently uniformly random for the intended purpose) sequence of - * numbers, even if the generator is good! - * The only way to ensure that the selected seed will make the generator - * produce a good sequence is to submit that sequence to a series of - * stringent tests, as provided by tools such as - * dieharder - * or TestU01. - *

- * - *

- * The current implementations have no provision for producing non-overlapping - * sequences. - * For parallel applications, a possible workaround is that each thread uses - * a generator of a different type (see {@link #TWO_CMRES_SELECT}). - *

- * - *

- * Note: - * Seeding is not equivalent to restoring the internal state of an - * already initialized generator. - * Indeed, generators can have a state that is more complex than the - * seed, and seeding is thus a transformation (from seed to state). - * Implementations do not provide the inverse transformation (from - * state to seed), hence it is not generally possible to know the seed - * that would initialize a new generator instance to the current state - * of another instance. - * Reseeding is also inefficient if the purpose is to continue the - * same sequence where another instance left off, as it would require - * to "replay" all the calls performed by that other instance (and it - * would require to know the number of calls to the primary source of - * randomness, which is also not usually accessible). - *
- * This factory thus provides a method for - * {@link #saveState(UniformRandomProvider) saving} the internal - * state of a generator. - * The state is encapsulated in an {@link State "opaque object"} to be - * used for {@link #restoreState(UniformRandomProvider,State) restoring} - * a generator (of the same type) to an identical state (e.g. to allow - * persistent storage, or to continue a sequence from where the original - * instance left off). - *

- * - * @since 4.0 - */ -public enum RandomSource { - /** - * Source of randomness is {@link org.apache.commons.math4.rng.internal.source32.JDKRandom}. - * Native seed type: {@code Long}. - */ - JDK(ProviderBuilder.RandomSourceInternal.JDK), - /** - * Source of randomness is {@link org.apache.commons.math4.rng.internal.source32.Well512a}. - * Native seed type: {@code int[]}. - */ - WELL_512_A(ProviderBuilder.RandomSourceInternal.WELL_512_A), - /** - * Source of randomness is {@link org.apache.commons.math4.rng.internal.source32.Well1024a}. - * Native seed type: {@code int[]}. - */ - WELL_1024_A(ProviderBuilder.RandomSourceInternal.WELL_1024_A), - /** - * Source of randomness is {@link org.apache.commons.math4.rng.internal.source32.Well19937a}. - * Native seed type: {@code int[]}. - */ - WELL_19937_A(ProviderBuilder.RandomSourceInternal.WELL_19937_A), - /** - * Source of randomness is {@link org.apache.commons.math4.rng.internal.source32.Well19937c}. - * Native seed type: {@code int[]}. - */ - WELL_19937_C(ProviderBuilder.RandomSourceInternal.WELL_19937_C), - /** - * Source of randomness is {@link org.apache.commons.math4.rng.internal.source32.Well44497a}. - * Native seed type: {@code int[]}. - */ - WELL_44497_A(ProviderBuilder.RandomSourceInternal.WELL_44497_A), - /** - * Source of randomness is {@link org.apache.commons.math4.rng.internal.source32.Well44497b}. - * Native seed type: {@code int[]}. - */ - WELL_44497_B(ProviderBuilder.RandomSourceInternal.WELL_44497_B), - /** - * Source of randomness is {@link org.apache.commons.math4.rng.internal.source32.MersenneTwister}. - * Native seed type: {@code int[]}. - */ - MT(ProviderBuilder.RandomSourceInternal.MT), - /** - * Source of randomness is {@link org.apache.commons.math4.rng.internal.source32.ISAACRandom}. - * Native seed type: {@code int[]}. - */ - ISAAC(ProviderBuilder.RandomSourceInternal.ISAAC), - /** - * Source of randomness is {@link org.apache.commons.math4.rng.internal.source64.SplitMix64}. - * Native seed type: {@code Long}. - */ - SPLIT_MIX_64(ProviderBuilder.RandomSourceInternal.SPLIT_MIX_64), - /** - * Source of randomness is {@link org.apache.commons.math4.rng.internal.source64.XorShift1024Star}. - * Native seed type: {@code long[]}. - */ - XOR_SHIFT_1024_S(ProviderBuilder.RandomSourceInternal.XOR_SHIFT_1024_S), - /** - * Source of randomness is {@link org.apache.commons.math4.rng.internal.source64.TwoCmres}. - * Native seed type: {@code Integer}. - */ - TWO_CMRES(ProviderBuilder.RandomSourceInternal.TWO_CMRES), - /** - * Source of randomness is {@link org.apache.commons.math4.rng.internal.source64.TwoCmres}, - * with explicit selection of the two subcycle generators. - * Native seed type: {@code Integer}. - */ - TWO_CMRES_SELECT(ProviderBuilder.RandomSourceInternal.TWO_CMRES_SELECT), - /** - * Source of randomness is {@link org.apache.commons.math4.rng.internal.source64.MersenneTwister64}. - * Native seed type: {@code long[]}. - */ - MT_64(ProviderBuilder.RandomSourceInternal.MT_64); - - /** Internal identifier. */ - private final ProviderBuilder.RandomSourceInternal internalIdentifier; - - /** - * @param id Internal identifier. - */ - RandomSource(ProviderBuilder.RandomSourceInternal id) { - internalIdentifier = id; - } - - /** - * @return the internal identifier. - */ - ProviderBuilder.RandomSourceInternal getInternalIdentifier() { - return internalIdentifier; - } - - /** - * Checks whether the type of given {@code seed} is the native type - * of the implementation. - * - * @param seed Seed value. - * @return {@code true} if the seed can be passed to the builder - * for this RNG type. - */ - public boolean isNativeSeed(Object seed) { - return internalIdentifier.isNativeSeed(seed); - } - - /** - * Marker interface used to define the "save" and "restore" - * functionality of the generators. - */ - public interface State {} - - /** - * Creates a random number generator with a random seed. - * - *

- * Example of usage: - *


-     *  UniformRandomProvider rng = RandomSource.create(RandomSource.MT);
-     * 
- *

- * - * @param source RNG type. - * @return the RNG. - */ - public static UniformRandomProvider create(RandomSource source) { - return create(source, null); - } - - /** - * Creates a random number generator with the given {@code seed}. - * - *

- * Example of usage: - *


-     *  UniformRandomProvider rng = RandomSource.create(RandomSource.TWO_CMRES_SELECT, 26219, 6, 9);
-     * 
- *

- * - *

- * Valid types for the {@code seed} are: - *

- *

- * - *

- * Notes: - *