MATH-1383 Commons Math now depends on Commons Rng.
Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/eeeb553c Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/eeeb553c Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/eeeb553c Branch: refs/heads/develop Commit: eeeb553cea4d90fb34fd314f943b206284dfc89b Parents: 827d964 Author: Gilles <gil...@harfang.homelinux.org> Authored: Thu Aug 18 03:15:39 2016 +0200 Committer: Gilles <gil...@harfang.homelinux.org> Committed: Thu Aug 18 03:15:39 2016 +0200 ---------------------------------------------------------------------- pom.xml | 6 + .../AbstractIntegerDistribution.java | 2 +- .../AbstractMultivariateRealDistribution.java | 2 +- .../distribution/AbstractRealDistribution.java | 2 +- .../math4/distribution/BetaDistribution.java | 2 +- .../distribution/ConstantRealDistribution.java | 2 +- .../distribution/EmpiricalDistribution.java | 2 +- .../distribution/EnumeratedDistribution.java | 2 +- .../EnumeratedIntegerDistribution.java | 2 +- .../EnumeratedRealDistribution.java | 2 +- .../distribution/ExponentialDistribution.java | 2 +- .../math4/distribution/GammaDistribution.java | 2 +- .../math4/distribution/IntegerDistribution.java | 2 +- .../distribution/LogNormalDistribution.java | 2 +- .../MixtureMultivariateRealDistribution.java | 2 +- .../MultivariateNormalDistribution.java | 2 +- .../MultivariateRealDistribution.java | 2 +- .../math4/distribution/NormalDistribution.java | 2 +- .../math4/distribution/ParetoDistribution.java | 2 +- .../math4/distribution/PoissonDistribution.java | 2 +- .../math4/distribution/RealDistribution.java | 2 +- .../UniformIntegerDistribution.java | 2 +- .../distribution/UniformRealDistribution.java | 2 +- .../math4/distribution/ZipfDistribution.java | 2 +- .../math4/genetics/GeneticAlgorithm.java | 4 +- .../commons/math4/genetics/NPointCrossover.java | 2 +- .../math4/genetics/OrderedCrossover.java | 2 +- .../math4/genetics/UniformCrossover.java | 2 +- .../ml/clustering/FuzzyKMeansClusterer.java | 4 +- .../ml/clustering/KMeansPlusPlusClusterer.java | 4 +- .../ml/neuralnet/FeatureInitializerFactory.java | 4 +- .../scalar/noderiv/CMAESOptimizer.java | 2 +- .../MultiStartUnivariateOptimizer.java | 2 +- .../math4/random/GaussianRandomGenerator.java | 2 +- .../commons/math4/random/JDKRandomAdaptor.java | 2 +- .../commons/math4/random/RandomGenerator.java | 2 +- .../commons/math4/random/RandomUtils.java | 2 +- .../apache/commons/math4/random/RngAdaptor.java | 4 +- .../math4/random/StableRandomGenerator.java | 2 +- .../math4/random/UniformRandomGenerator.java | 2 +- .../random/UnitSphereRandomVectorGenerator.java | 4 +- .../apache/commons/math4/rng/RandomSource.java | 418 ------------ .../math4/rng/UniformRandomProvider.java | 118 ---- .../math4/rng/internal/BaseProvider.java | 141 ---- .../math4/rng/internal/ProviderBuilder.java | 346 ---------- .../math4/rng/internal/StateSettable.java | 49 -- .../math4/rng/internal/package-info.java | 51 -- .../rng/internal/source32/AbstractWell.java | 208 ------ .../rng/internal/source32/ISAACRandom.java | 270 -------- .../rng/internal/source32/IntProvider.java | 137 ---- .../math4/rng/internal/source32/JDKRandom.java | 95 --- .../rng/internal/source32/MersenneTwister.java | 230 ------- .../rng/internal/source32/RandomIntSource.java | 30 - .../math4/rng/internal/source32/Well1024a.java | 78 --- .../math4/rng/internal/source32/Well19937a.java | 80 --- .../math4/rng/internal/source32/Well19937c.java | 85 --- .../math4/rng/internal/source32/Well44497a.java | 83 --- .../math4/rng/internal/source32/Well44497b.java | 90 --- .../math4/rng/internal/source32/Well512a.java | 78 --- .../rng/internal/source32/package-info.java | 52 -- .../rng/internal/source64/LongProvider.java | 141 ---- .../internal/source64/MersenneTwister64.java | 201 ------ .../rng/internal/source64/RandomLongSource.java | 30 - .../math4/rng/internal/source64/SplitMix64.java | 78 --- .../math4/rng/internal/source64/TwoCmres.java | 310 --------- .../rng/internal/source64/XorShift1024Star.java | 108 --- .../rng/internal/source64/package-info.java | 52 -- .../math4/rng/internal/util/Int2Long.java | 37 - .../math4/rng/internal/util/IntArray2Int.java | 41 -- .../rng/internal/util/IntArray2LongArray.java | 44 -- .../math4/rng/internal/util/Long2Int.java | 36 - .../math4/rng/internal/util/Long2IntArray.java | 50 -- .../math4/rng/internal/util/Long2LongArray.java | 56 -- .../rng/internal/util/LongArray2IntArray.java | 43 -- .../math4/rng/internal/util/LongArray2Long.java | 41 -- .../math4/rng/internal/util/LongMixInt.java | 50 -- .../math4/rng/internal/util/LongMixLong.java | 56 -- .../math4/rng/internal/util/NoOpConverter.java | 40 -- .../math4/rng/internal/util/NumberFactory.java | 327 --------- .../math4/rng/internal/util/SeedConverter.java | 35 - .../internal/util/SeedConverterComposer.java | 56 -- .../math4/rng/internal/util/SeedFactory.java | 262 -------- .../math4/rng/internal/util/package-info.java | 22 - .../apache/commons/math4/rng/package-info.java | 95 --- .../stat/inference/KolmogorovSmirnovTest.java | 4 +- .../math4/stat/ranking/NaturalRanking.java | 4 +- .../apache/commons/math4/util/MathArrays.java | 4 +- .../math4/util/RandomPivotingStrategy.java | 4 +- .../math4/ExtendedFieldElementAbstractTest.java | 4 +- .../org/apache/commons/math4/PerfTestUtils.java | 4 +- .../DerivativeStructureTest.java | 4 +- .../differentiation/SparseGradientTest.java | 4 +- .../math4/analysis/function/LogitTest.java | 4 +- .../AkimaSplineInterpolatorTest.java | 4 +- .../BicubicInterpolatingFunctionTest.java | 4 +- .../interpolation/BicubicInterpolatorTest.java | 4 +- ...eBicubicSplineInterpolatingFunctionTest.java | 4 +- .../PiecewiseBicubicSplineInterpolatorTest.java | 4 +- .../TricubicInterpolatingFunctionTest.java | 4 +- .../distribution/BetaDistributionTest.java | 4 +- .../distribution/EmpiricalDistributionTest.java | 2 +- .../EnumeratedIntegerDistributionTest.java | 2 +- .../EnumeratedRealDistributionTest.java | 4 +- .../HypergeometricDistributionTest.java | 2 +- .../IntegerDistributionAbstractTest.java | 2 +- ...xtureMultivariateNormalDistributionTest.java | 2 +- .../MultivariateNormalDistributionTest.java | 2 +- .../RealDistributionAbstractTest.java | 2 +- .../distribution/ZipfDistributionTest.java | 2 +- .../commons/math4/filter/KalmanFilterTest.java | 2 +- .../fitting/PolynomialCurveFitterTest.java | 2 +- .../math4/fitting/SimpleCurveFitterTest.java | 2 +- .../RandomCirclePointGenerator.java | 4 +- .../RandomStraightLinePointGenerator.java | 4 +- .../geometry/enclosing/WelzlEncloser2DTest.java | 4 +- .../geometry/enclosing/WelzlEncloser3DTest.java | 4 +- .../euclidean/threed/FieldRotationDSTest.java | 4 +- .../euclidean/threed/FieldRotationDfpTest.java | 4 +- .../euclidean/threed/FieldVector3DTest.java | 4 +- .../euclidean/threed/PolyhedronsSetTest.java | 4 +- .../euclidean/threed/SphereGeneratorTest.java | 4 +- .../geometry/euclidean/threed/Vector3DTest.java | 4 +- .../euclidean/twod/DiskGeneratorTest.java | 4 +- .../hull/ConvexHullGenerator2DAbstractTest.java | 4 +- .../geometry/spherical/twod/CircleTest.java | 4 +- .../twod/SphericalPolygonsSetTest.java | 2 +- .../math4/linear/EigenDecompositionTest.java | 2 +- .../math4/linear/HessenbergTransformerTest.java | 2 +- .../math4/linear/SchurTransformerTest.java | 2 +- .../ml/clustering/FuzzyKMeansClustererTest.java | 4 +- .../clustering/KMeansPlusPlusClustererTest.java | 4 +- .../sofm/TravellingSalesmanSolver.java | 4 +- .../math4/ode/events/EventFilterTest.java | 4 +- .../MultiStartMultivariateOptimizerTest.java | 4 +- .../scalar/noderiv/CMAESOptimizerTest.java | 2 +- .../MultiStartUnivariateOptimizerTest.java | 4 +- .../CorrelatedRandomVectorGeneratorTest.java | 4 +- .../random/GaussianRandomGeneratorTest.java | 4 +- .../math4/random/JDKRandomAdaptorTest.java | 4 +- .../RandomUtilsDataGeneratorAbstractTest.java | 2 +- .../math4/random/StableRandomGeneratorTest.java | 4 +- .../random/SynchronizedRandomGeneratorTest.java | 2 +- .../UncorrelatedRandomVectorGeneratorTest.java | 2 +- .../random/UniformRandomGeneratorTest.java | 4 +- .../UnitSphereRandomVectorGeneratorTest.java | 4 +- .../math4/rng/Providers32ParametricTest.java | 64 -- .../math4/rng/Providers64ParametricTest.java | 64 -- .../rng/ProvidersCommonParametricTest.java | 667 ------------------- .../apache/commons/math4/rng/ProvidersList.java | 157 ----- .../rng/internal/source32/ISAACRandomTest.java | 389 ----------- .../rng/internal/source32/JDKRandomTest.java | 38 -- .../internal/source32/MersenneTwisterTest.java | 240 ------- .../rng/internal/source32/Well1024aTest.java | 71 -- .../rng/internal/source32/Well19937aTest.java | 109 --- .../rng/internal/source32/Well19937cTest.java | 109 --- .../rng/internal/source32/Well44497aTest.java | 109 --- .../rng/internal/source32/Well44497bTest.java | 109 --- .../rng/internal/source32/Well512aTest.java | 69 -- .../source64/MersenneTwister64Test.java | 239 ------- .../rng/internal/source64/SplitMix64Test.java | 45 -- .../rng/internal/source64/TwoCmresTest.java | 55 -- .../internal/source64/XorShift1024StarTest.java | 55 -- .../rng/internal/util/NumberFactoryTest.java | 164 ----- .../rng/internal/util/SeedFactoryTest.java | 111 --- .../correlation/KendallsCorrelationTest.java | 4 +- .../correlation/StorelessCovarianceTest.java | 4 +- .../AggregateSummaryStatisticsTest.java | 2 +- .../UnivariateStatisticAbstractTest.java | 2 +- .../descriptive/rank/PSquarePercentileTest.java | 4 +- .../stat/descriptive/rank/PercentileTest.java | 4 +- .../inference/KolmogorovSmirnovTestTest.java | 4 +- .../math4/stat/ranking/NaturalRankingTest.java | 4 +- .../GLSMultipleLinearRegressionTest.java | 4 +- .../stat/regression/SimpleRegressionTest.java | 4 +- .../apache/commons/math4/util/FastMathTest.java | 4 +- .../commons/math4/util/MathArraysTest.java | 4 +- .../commons/math4/util/MathUtilsTest.java | 4 +- .../math4/util/ResizableDoubleArrayTest.java | 2 +- 178 files changed, 180 insertions(+), 7888 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index da4b69b..d0fed34 100644 --- a/pom.xml +++ b/pom.xml @@ -361,6 +361,12 @@ <dependencies> <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-rng</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/AbstractIntegerDistribution.java ---------------------------------------------------------------------- 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 0bc377d..f502e0c 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; /** http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/AbstractMultivariateRealDistribution.java ---------------------------------------------------------------------- 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 1c4adef..f48d188 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. http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/AbstractRealDistribution.java ---------------------------------------------------------------------- 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 057dd8a..f874f16 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; /** http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/BetaDistribution.java ---------------------------------------------------------------------- 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 abccb93..31a1d30 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; http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/ConstantRealDistribution.java ---------------------------------------------------------------------- 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 a34179a..b699e03 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. http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/EmpiricalDistribution.java ---------------------------------------------------------------------- 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 f898d95..51444b7 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; http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/EnumeratedDistribution.java ---------------------------------------------------------------------- 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 88ce037..bfcd1af 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; http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistribution.java ---------------------------------------------------------------------- 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 e8f3ed6..110e408 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; /** http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/EnumeratedRealDistribution.java ---------------------------------------------------------------------- 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 0e34f5a..b21b994 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; /** http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/ExponentialDistribution.java ---------------------------------------------------------------------- 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 9527aa0..fb44536 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; http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/GammaDistribution.java ---------------------------------------------------------------------- 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 413493f..a1d2d87 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; http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/IntegerDistribution.java ---------------------------------------------------------------------- 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 aed97ab..05076ae 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. http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/LogNormalDistribution.java ---------------------------------------------------------------------- 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 6b155d5..d8a0229 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; http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateRealDistribution.java ---------------------------------------------------------------------- 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 4caee3f..893c543 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; /** http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/MultivariateNormalDistribution.java ---------------------------------------------------------------------- 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 da270ad..097caa0 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; http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/MultivariateRealDistribution.java ---------------------------------------------------------------------- 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 c299684..ef5fca9 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. http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/NormalDistribution.java ---------------------------------------------------------------------- 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 b8e919b..d971eb6 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; http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/ParetoDistribution.java ---------------------------------------------------------------------- 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 04427da..b7c405f 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; /** http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/PoissonDistribution.java ---------------------------------------------------------------------- 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 49a08da..1c7b8db 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. http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/RealDistribution.java ---------------------------------------------------------------------- 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 7ddc1fd..a9e8cb2 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. http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/UniformIntegerDistribution.java ---------------------------------------------------------------------- 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 d1489d3..1e89c43 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. http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/UniformRealDistribution.java ---------------------------------------------------------------------- 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 a7a1c4d..343bee0 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. http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/distribution/ZipfDistribution.java ---------------------------------------------------------------------- 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 82e9fb3..3ea152c 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; /** http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/genetics/GeneticAlgorithm.java ---------------------------------------------------------------------- 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 d76fe93..b43bf52 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 http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/genetics/NPointCrossover.java ---------------------------------------------------------------------- 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 847e9bc..6a497ab 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 http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/genetics/OrderedCrossover.java ---------------------------------------------------------------------- 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 6b6502c..a1e7772 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; /** http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/genetics/UniformCrossover.java ---------------------------------------------------------------------- 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 df5b929..74fac3d 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 http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClusterer.java ---------------------------------------------------------------------- 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 f650d24..cb6f011 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; http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClusterer.java ---------------------------------------------------------------------- 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 0b8ad96..e0eeac4 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; http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/ml/neuralnet/FeatureInitializerFactory.java ---------------------------------------------------------------------- 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 9c36dd3..9ab532c 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 http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizer.java ---------------------------------------------------------------------- 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 8fe9afe..6eb2ecc 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; http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/optim/univariate/MultiStartUnivariateOptimizer.java ---------------------------------------------------------------------- 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 65bfa67..373a307 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 http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/random/GaussianRandomGenerator.java ---------------------------------------------------------------------- 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 c70a7df..fc7f98c 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; http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/random/JDKRandomAdaptor.java ---------------------------------------------------------------------- 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 f3ab22e..f92d435 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; http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/random/RandomGenerator.java ---------------------------------------------------------------------- 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 49842ce..c698f85 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 <code>java.util.Random</code>. * * @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 { http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/random/RandomUtils.java ---------------------------------------------------------------------- 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 610b320..5af7cbb 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; /** http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/random/RngAdaptor.java ---------------------------------------------------------------------- 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 d132c95..5a24fec 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. http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/random/StableRandomGenerator.java ---------------------------------------------------------------------- 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 3199c0f..f3a851b 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; http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/random/UniformRandomGenerator.java ---------------------------------------------------------------------- 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 1a07ba4..d43c6d9 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. http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/random/UnitSphereRandomVectorGenerator.java ---------------------------------------------------------------------- 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 33993f5..19a64d6 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; http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/rng/RandomSource.java ---------------------------------------------------------------------- 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 fee11a3..0000000 --- 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. - * <p> - * Usage examples: - * <pre><code> - * UniformRandomProvider rng = RandomSource.create(RandomSource.MT); - * </code></pre> - * or - * <pre><code> - * final int[] seed = new int[] { 196, 9, 0, 226 }; - * UniformRandomProvider rng = RandomSource.create(RandomSource.MT, seed); - * </code></pre> - * or - * <pre><code> - * final int[] seed = RandomSource.createIntArray(256); - * UniformRandomProvider rng = RandomSource.create(RandomSource.MT, seed); - * </code></pre> - * 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. - * <br> - * 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. - * </p> - * - * <p> - * Seeding is the procedure by which a value (or set of values) is - * used to <i>initialize</i> 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. - * </p> - * - * <p> - * 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. - * <br> - * The reference algorithm's seeding procedure (if provided) operates - * on a value of a (single) <i>native</i> type: - * Each concrete implementation's constructor creates an instance using - * the native type whose information contents is used to set the - * internal state. - * <br> - * 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. - * <br> - * 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 <i>not</i> 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. - * <br> - * 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 <i>not</i> be the same as the sequences produced - * by other implementations of the same algorithm! - * </p> - * - * <p> - * 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}. - * <br> - * 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 <i>good</i> (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 - * <a href="http://www.phy.duke.edu/~rgb/General/dieharder.php">dieharder</a> - * or <a href="http://simul.iro.umontreal.ca/testu01/tu01.html">TestU01</a>. - * </p> - * - * <p> - * 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}). - * </p> - * - * <p> - * <b>Note:</b> - * Seeding is not equivalent to restoring the internal state of an - * <i>already initialized</i> 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). - * <br> - * 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). - * </p> - * - * @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. - * - * <p> - * Example of usage: - * <pre><code> - * UniformRandomProvider rng = RandomSource.create(RandomSource.MT); - * </code></pre> - * </p> - * - * @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}. - * - * <p> - * Example of usage: - * <pre><code> - * UniformRandomProvider rng = RandomSource.create(RandomSource.TWO_CMRES_SELECT, 26219, 6, 9); - * </code></pre> - * </p> - * - * <p> - * Valid types for the {@code seed} are: - * <ul> - * <li>{@code Integer} (or {@code int})</li> - * <li>{@code Long} (or {@code long})</li> - * <li>{@code int[]}</li> - * <li>{@code long[]}</li> - * </ul> - * </p> - * - * <p> - * Notes: - * <ul> - * <li> - * When the seed type passed as argument is more complex (i.e. more - * bits can be independently chosen) than the generator's - * {@link #isNativeSeed(Object) native type}, the conversion of a - * set of different seeds will necessarily result in the same value - * of the native seed type. - * </li> - * <li> - * When the native seed type is an array, the same remark applies - * when the array contains more bits than the state of the generator. - * </li> - * <li> - * When the native seed type is an array and the {@code seed} is - * {@code null}, the size of the generated array will be 128. - * </li> - * </p> - * - * @param source RNG type. - * @param seed Seed value. It can be {@code null} (in which case a - * random value will be used). - * @param data Additional arguments to the implementation's constructor. - * Please refer to the documentation of each specific implementation. - * @return the RNG. - * @throws MathUnsupportedOperationException if the type of the - * {@code seed} is invalid. - * @throws org.apache.commons.math4.exception.InsufficientDataException - * if data is missing to initialize the generator implemented by the - * given {@code source}. - */ - public static UniformRandomProvider create(RandomSource source, - Object seed, - Object ... data) { - return ProviderBuilder.create(source.getInternalIdentifier(), seed, data); - } - - /** - * Gets the number of elements of the set of "subcycle" generators from - * which two can be selected in order to create a {@link TwoCmres} RNG. - * - * @return the number of implemented subcycle generators. - */ - public static int numberOfCmresGenerators() { - return TwoCmres.numberOfSubcycleGenerators(); - } - - /** - * Saves the state of a RNG. - * - * @param provider Provider. - * @return the current state of the given {@code provider}. - * @throws MathUnsupportedOperationException if the {@code provider} is - * not an object created by this factory or the underlying source of - * randomness does not support this functionality. - * - * @see #restoreState(UniformRandomProvider,RandomSource.State) - */ - public static State saveState(UniformRandomProvider provider) { - if (!(provider instanceof BaseProvider)) { - throw new MathUnsupportedOperationException(); - } else { - return ((BaseProvider) provider).getState(); - } - } - - /** - * Restores the state of a RNG. - * - * @param provider Provider. - * @param state State which the {@code provider} will be set to. - * This parameter must have been obtained by a call to - * {@link #saveState(UniformRandomProvider) saveState(rng)} - * where {@code rng} is either the same object as {@code provider}, - * or an object of the exact same class. - * @throws MathUnsupportedOperationException if the {@code provider} is - * not an object created by this factory or the underlying source of - * randomness does not support this functionality. - * @throws org.apache.commons.math4.exception.InsufficientDataException - * if it was detected that the {@code state} is incompatible with the - * given {@code provider}. - * - * @see #saveState(UniformRandomProvider) - */ - public static void restoreState(UniformRandomProvider provider, - State state) { - if (!(provider instanceof BaseProvider)) { - throw new MathUnsupportedOperationException(); - } else { - ((BaseProvider) provider).setState(state); - } - } - - /** - * Creates a number for use as a seed. - * - * @return a random number. - */ - public static int createInt() { - return SeedFactory.createInt(); - } - - /** - * Creates a number for use as a seed. - * - * @return a random number. - */ - public static long createLong() { - return SeedFactory.createLong(); - } - - /** - * Creates an array of numbers for use as a seed. - * - * @param n Size of the array to create. - * @return an array of {@code n} random numbers. - */ - public static int[] createIntArray(int n) { - return SeedFactory.createIntArray(n); - } - - /** - * Creates an array of numbers for use as a seed. - * - * @param n Size of the array to create. - * @return an array of {@code n} random numbers. - */ - public static long[] createLongArray(int n) { - return SeedFactory.createLongArray(n); - } -} http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/rng/UniformRandomProvider.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/rng/UniformRandomProvider.java b/src/main/java/org/apache/commons/math4/rng/UniformRandomProvider.java deleted file mode 100644 index ef17f06..0000000 --- a/src/main/java/org/apache/commons/math4/rng/UniformRandomProvider.java +++ /dev/null @@ -1,118 +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; - -/** - * Applies to generators of random number sequences that follow a uniform - * distribution. - * - * @since 4.0 - */ -public interface UniformRandomProvider { - /** - * Generates {@code byte} values and places them into a user-supplied array. - * <p> - * The number of random bytes produced is equal to the length of the - * the byte array. - * </p> - * - * @param bytes Byte array in which to put the random bytes. - * Cannot be {@code null}. - */ - void nextBytes(byte[] bytes); - - /** - * Generates {@code byte} values and places them into a user-supplied array. - * - * <p> - * The array is filled with bytes extracted from random integers. - * This implies that the number of random bytes generated may be larger than - * the length of the byte array. - * </p> - * - * @param bytes Array in which to put the generated bytes. - * Cannot be {@code null}. - * @param start Index at which to start inserting the generated bytes. - * @param len Number of bytes to insert. - * @throws org.apache.commons.math4.exception.OutOfRangeException - * if {@code start < 0} or {@code start >= bytes.length}. - * @throws org.apache.commons.math4.exception.OutOfRangeException - * if {@code len < 0} or {@code len > bytes.length - start}. - */ - void nextBytes(byte[] bytes, - int start, - int len); - - /** - * Generates an {@code int} value. - * - * @return the next random value. - */ - int nextInt(); - - /** - * Generates an {@code int} value between 0 (inclusive) and the - * specified value (exclusive). - * - * @param n Bound on the random number to be returned. Must be positive. - * @return a random {@code int} value between 0 (inclusive) and n - * (exclusive). - * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException - * if {@code n} is not positive. - */ - int nextInt(int n); - - /** - * Generates a {@code long} value. - * - * @return the next random value. - */ - long nextLong(); - - /** - * Generates a {@code long} value between 0 (inclusive) and the specified - * value (exclusive). - * - * @param n Bound on the random number to be returned. Must be positive. - * @return a random {@code long} value between 0 (inclusive) and n - * (exclusive). - * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException - * if {@code n} is not positive. - */ - long nextLong(long n); - - /** - * Generates a {@code boolean} value. - * - * @return the next random value. - */ - boolean nextBoolean(); - - /** - * Generates a {@code float} value between 0 and 1. - * - * @return the next random value between 0 and 1. - */ - float nextFloat(); - - /** - * Generates a {@code double} value between 0 and 1. - * - * @return the next random value between 0 and 1. - */ - double nextDouble(); -} http://git-wip-us.apache.org/repos/asf/commons-math/blob/eeeb553c/src/main/java/org/apache/commons/math4/rng/internal/BaseProvider.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/rng/internal/BaseProvider.java b/src/main/java/org/apache/commons/math4/rng/internal/BaseProvider.java deleted file mode 100644 index e29d854..0000000 --- a/src/main/java/org/apache/commons/math4/rng/internal/BaseProvider.java +++ /dev/null @@ -1,141 +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.internal; - -import java.util.Arrays; -import java.io.Serializable; -import org.apache.commons.math4.exception.MathUnsupportedOperationException; -import org.apache.commons.math4.exception.NotStrictlyPositiveException; -import org.apache.commons.math4.rng.UniformRandomProvider; -import org.apache.commons.math4.rng.RandomSource; - -/** - * Base class with default implementation for common methods. - */ -public abstract class BaseProvider - implements UniformRandomProvider, - StateSettable { - /** {@inheritDoc} */ - @Override - public int nextInt(int n) throws IllegalArgumentException { - if (n > 0) { - if ((n & -n) == n) { - return (int) ((n * (long) (nextInt() >>> 1)) >> 31); - } - int bits; - int val; - do { - bits = nextInt() >>> 1; - val = bits % n; - } while (bits - val + (n - 1) < 0); - return val; - } - - throw new NotStrictlyPositiveException(n); - } - - /** {@inheritDoc} */ - @Override - public long nextLong(long n) { - if (n > 0) { - long bits; - long val; - do { - bits = nextLong() >>> 1; - val = bits % n; - } while (bits - val + (n - 1) < 0); - return val; - } - - throw new NotStrictlyPositiveException(n); - } - - /** {@inheritDoc} */ - @Override - public String toString() { - return getClass().getName(); - } - - /** {@inheritDoc} */ - @Override - public RandomSource.State getState() { - return new State(getStateInternal()); - } - - /** {@inheritDoc} */ - @Override - public void setState(RandomSource.State state) { - // Cast will intentionally fail if the argument is not one we created. - final State s = (State) state; - setStateInternal(s.getState()); - } - - /** - * Creates a snapshot of the RNG state. - * - * @return the internal state. - * @throws MathUnsupportedOperationException if not implemented. - */ - protected byte[] getStateInternal() { - throw new MathUnsupportedOperationException(); - } - - /** - * Resets the RNG to the given {@code state}. - * - * @param state State (previously obtained by a call to - * {@link #getStateInternal()}). - * @throws MathUnsupportedOperationException if not implemented. - */ - protected void setStateInternal(byte[] state) { - throw new MathUnsupportedOperationException(); - } - - /** - * "Black-box" state. - * Its sole purpose is to store all the data needed to recover - * the same state in order to restart a sequence where it left - * off. - * External code should not to modify the data contained in - * instances of this class. - */ - private static class State - implements RandomSource.State, - Serializable { - /** Serializable version identifier. */ - private static final long serialVersionUID = 4720160226L; - /** Internal state. */ - private byte[] state; - - /** - * @param state Mapping of all the data which a subclass of - * {@link BaseProvider} needs in order to reset its internal - * state. - */ - State(byte[] state) { - this.state = Arrays.copyOf(state, state.length); - } - - /** - * @return the internal state. - */ - byte[] getState() { - return Arrays.copyOf(state, state.length); - } - } -}