This is an automated email from the ASF dual-hosted git repository.

erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git


The following commit(s) were added to refs/heads/master by this push:
     new 0020bc5a7 Code examples are compilable again.
0020bc5a7 is described below

commit 0020bc5a7bce41e39c341b71dc6bf5723f68e987
Author: Gilles Sadowski <gillese...@gmail.com>
AuthorDate: Sat Apr 5 11:05:50 2025 +0200

    Code examples are compilable again.
---
 .../userguide/ClusterAlgorithmComparison.java      |  63 ++++-----
 ...erformance.java => JdkMathTestPerformance.java} | 150 ++++++++++-----------
 .../LowDiscrepancyGeneratorComparison.java         |  45 +++----
 .../commons/math4/userguide}/PerfTestUtils.java    |   4 +-
 .../math4/userguide/filter/CannonballExample.java  |  36 ++---
 .../userguide/filter/ConstantVoltageExample.java   |  30 ++---
 .../userguide/genetics/HelloWorldExample.java      |  26 ++--
 .../userguide/genetics/ImageEvolutionExample.java  |  12 +-
 .../commons/math4/userguide/genetics/Polygon.java  |   6 +-
 .../userguide/genetics/PolygonChromosome.java      |   6 +-
 .../userguide/genetics/RandomPolygonMutation.java  |   4 +-
 src/userguide/pom.xml                              |  26 +---
 12 files changed, 192 insertions(+), 216 deletions(-)

diff --git 
a/src/userguide/java/org/apache/commons/math4/userguide/ClusterAlgorithmComparison.java
 
b/src/userguide/java/org/apache/commons/math4/userguide/ClusterAlgorithmComparison.java
index 9a9073da5..accab2498 100644
--- 
a/src/userguide/java/org/apache/commons/math4/userguide/ClusterAlgorithmComparison.java
+++ 
b/src/userguide/java/org/apache/commons/math4/userguide/ClusterAlgorithmComparison.java
@@ -41,16 +41,16 @@ import 
org.apache.commons.statistics.distribution.UniformContinuousDistribution;
 import org.apache.commons.statistics.distribution.NormalDistribution;
 import org.apache.commons.geometry.euclidean.twod.Vector2D;
 
-import org.apache.commons.math4.ml.clustering.Cluster;
-import org.apache.commons.math4.ml.clustering.Clusterable;
-import org.apache.commons.math4.ml.clustering.Clusterer;
-import org.apache.commons.math4.ml.clustering.DBSCANClusterer;
-import org.apache.commons.math4.ml.clustering.DoublePoint;
-import org.apache.commons.math4.ml.clustering.FuzzyKMeansClusterer;
-import org.apache.commons.math4.ml.clustering.KMeansPlusPlusClusterer;
-import org.apache.commons.math4.random.SobolSequenceGenerator;
-import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Pair;
+import org.apache.commons.math4.legacy.ml.clustering.Cluster;
+import org.apache.commons.math4.legacy.ml.clustering.Clusterable;
+import org.apache.commons.math4.legacy.ml.clustering.Clusterer;
+import org.apache.commons.math4.legacy.ml.clustering.DBSCANClusterer;
+import org.apache.commons.math4.legacy.ml.clustering.DoublePoint;
+import org.apache.commons.math4.legacy.ml.clustering.FuzzyKMeansClusterer;
+import org.apache.commons.math4.legacy.ml.clustering.KMeansPlusPlusClusterer;
+import org.apache.commons.math4.legacy.random.SobolSequenceGenerator;
+import org.apache.commons.math4.core.jdkmath.JdkMath;
+import org.apache.commons.math4.legacy.core.Pair;
 import org.apache.commons.math4.userguide.ExampleUtils.ExampleFrame;
 
 /**
@@ -69,13 +69,13 @@ public class ClusterAlgorithmComparison {
             throw new IllegalArgumentException();
         }
 
-        ContinuousDistribution.Sampler dist = new NormalDistribution(0.0, 
noise).createSampler(rng);
+        ContinuousDistribution.Sampler dist = NormalDistribution.of(0.0, 
noise).createSampler(rng);
 
         List<Vector2D> points = new ArrayList<>();
-        double range = 2.0 * FastMath.PI;
+        double range = 2.0 * JdkMath.PI;
         double step = range / (samples / 2.0 + 1);
         for (double angle = 0; angle < range; angle += step) {
-            Vector2D outerCircle = Vector2D.of(FastMath.cos(angle), 
FastMath.sin(angle));
+            Vector2D outerCircle = Vector2D.of(JdkMath.cos(angle), 
JdkMath.sin(angle));
             Vector2D innerCircle = outerCircle.multiply(factor);
 
             points.add(outerCircle.add(generateNoiseVector(dist)));
@@ -93,22 +93,22 @@ public class ClusterAlgorithmComparison {
                                            boolean shuffle,
                                            double noise,
                                            UniformRandomProvider rng) {
-        ContinuousDistribution.Sampler dist = new NormalDistribution(0.0, 
noise).createSampler(rng);
+        ContinuousDistribution.Sampler dist = NormalDistribution.of(0.0, 
noise).createSampler(rng);
 
         int nSamplesOut = samples / 2;
         int nSamplesIn = samples - nSamplesOut;
 
         List<Vector2D> points = new ArrayList<>();
-        double range = FastMath.PI;
+        double range = JdkMath.PI;
         double step = range / (nSamplesOut / 2.0);
         for (double angle = 0; angle < range; angle += step) {
-            Vector2D outerCircle = Vector2D.of(FastMath.cos(angle), 
FastMath.sin(angle));
+            Vector2D outerCircle = Vector2D.of(JdkMath.cos(angle), 
JdkMath.sin(angle));
             points.add(outerCircle.add(generateNoiseVector(dist)));
         }
 
         step = range / (nSamplesIn / 2.0);
         for (double angle = 0; angle < range; angle += step) {
-            Vector2D innerCircle = Vector2D.of(1 - FastMath.cos(angle), 1 - 
FastMath.sin(angle) - 0.5);
+            Vector2D innerCircle = Vector2D.of(1 - JdkMath.cos(angle), 1 - 
JdkMath.sin(angle) - 0.5);
             points.add(innerCircle.add(generateNoiseVector(dist)));
         }
 
@@ -126,8 +126,8 @@ public class ClusterAlgorithmComparison {
                                            double max,
                                            boolean shuffle,
                                            UniformRandomProvider rng) {
-        ContinuousDistribution.Sampler uniform = new 
UniformContinuousDistribution(min, max).createSampler(rng);
-        ContinuousDistribution.Sampler gauss = new NormalDistribution(0.0, 
clusterStd).createSampler(rng);
+        ContinuousDistribution.Sampler uniform = 
UniformContinuousDistribution.of(min, max).createSampler(rng);
+        ContinuousDistribution.Sampler gauss = NormalDistribution.of(0.0, 
clusterStd).createSampler(rng);
 
         Vector2D[] centerPoints = new Vector2D[centers];
         for (int i = 0; i < centers; i++) {
@@ -161,7 +161,7 @@ public class ClusterAlgorithmComparison {
         generator.skipTo(999999);
         List<Vector2D> points = new ArrayList<>();
         for (double i = 0; i < samples; i++) {
-            double[] vector = generator.nextVector();
+            double[] vector = generator.get();
             vector[0] = vector[0] * 2 - 1;
             vector[1] = vector[1] * 2 - 1;
             Vector2D point = Vector2D.of(vector);
@@ -205,25 +205,20 @@ public class ClusterAlgorithmComparison {
 
             final long seed = RandomSource.createLong(); // Random seed.
             UniformRandomProvider rng = 
RandomSource.create(RandomSource.WELL_19937_C, seed);
-            List<List<DoublePoint>> datasets = new 
ArrayList<List<DoublePoint>>();
+            List<List<DoublePoint>> datasets = new ArrayList<>();
 
             datasets.add(normalize(makeCircles(nSamples, true, 0.04, 0.5, 
rng), -1, 1, -1, 1));
             datasets.add(normalize(makeMoons(nSamples, true, 0.04, rng), -1, 
2, -1, 1));
             datasets.add(normalize(makeBlobs(nSamples, 3, 1.0, -10, 10, true, 
rng), -12, 12, -12, 12));
             datasets.add(normalize(makeRandom(nSamples), -1, 1, -1, 1));
 
-            List<Pair<String, Clusterer<DoublePoint>>> algorithms = new 
ArrayList<>();
+            List<Pair<String, ? extends Clusterer<DoublePoint>>> algorithms = 
new ArrayList<>();
 
-            algorithms.add(new Pair<String, 
Clusterer<DoublePoint>>("KMeans\n(k=2)",
-                                                                    new 
KMeansPlusPlusClusterer<>(2)));
-            algorithms.add(new Pair<String, 
Clusterer<DoublePoint>>("KMeans\n(k=3)",
-                                                                    new 
KMeansPlusPlusClusterer<>(3)));
-            algorithms.add(new Pair<String, 
Clusterer<DoublePoint>>("FuzzyKMeans\n(k=3, fuzzy=2)",
-                                                                    new 
FuzzyKMeansClusterer<>(3, 2)));
-            algorithms.add(new Pair<String, 
Clusterer<DoublePoint>>("FuzzyKMeans\n(k=3, fuzzy=10)",
-                                                                    new 
FuzzyKMeansClusterer<>(3, 10)));
-            algorithms.add(new Pair<String, 
Clusterer<DoublePoint>>("DBSCAN\n(eps=.1, min=3)",
-                                                                    new 
DBSCANClusterer<>(0.1, 3)));
+            algorithms.add(new Pair<>("KMeans\n(k=2)", new 
KMeansPlusPlusClusterer<DoublePoint>(2)));
+            algorithms.add(new Pair<>("KMeans\n(k=3)", new 
KMeansPlusPlusClusterer<DoublePoint>(3)));
+            algorithms.add(new Pair<>("FuzzyKMeans\n(k=3, fuzzy=2)", new 
FuzzyKMeansClusterer<DoublePoint>(3, 2)));
+            algorithms.add(new Pair<>("FuzzyKMeans\n(k=3, fuzzy=10)", new 
FuzzyKMeansClusterer<DoublePoint>(3, 10)));
+            algorithms.add(new Pair<>("DBSCAN\n(eps=.1, min=3)", new 
DBSCANClusterer<DoublePoint>(0.1, 3)));
 
             GridBagConstraints c = new GridBagConstraints();
             c.fill = GridBagConstraints.VERTICAL;
@@ -231,7 +226,7 @@ public class ClusterAlgorithmComparison {
             c.gridy = 0;
             c.insets = new Insets(2, 2, 2, 2);
 
-            for (Pair<String, Clusterer<DoublePoint>> pair : algorithms) {
+            for (Pair<String, ? extends Clusterer<DoublePoint>> pair : 
algorithms) {
                 JLabel text = new JLabel("<html><body>" + 
pair.getFirst().replace("\n", "<br>"));
                 add(text, c);
                 c.gridx++;
@@ -240,7 +235,7 @@ public class ClusterAlgorithmComparison {
 
             for (List<DoublePoint> dataset : datasets) {
                 c.gridx = 0;
-                for (Pair<String, Clusterer<DoublePoint>> pair : algorithms) {
+                for (Pair<String, ? extends Clusterer<DoublePoint>> pair : 
algorithms) {
                     long start = System.currentTimeMillis();
                     List<? extends Cluster<DoublePoint>> clusters = 
pair.getSecond().cluster(dataset);
                     long end = System.currentTimeMillis();
diff --git 
a/src/userguide/java/org/apache/commons/math4/userguide/FastMathTestPerformance.java
 
b/src/userguide/java/org/apache/commons/math4/userguide/JdkMathTestPerformance.java
similarity index 91%
rename from 
src/userguide/java/org/apache/commons/math4/userguide/FastMathTestPerformance.java
rename to 
src/userguide/java/org/apache/commons/math4/userguide/JdkMathTestPerformance.java
index cbe682b3a..3e511ab2d 100644
--- 
a/src/userguide/java/org/apache/commons/math4/userguide/FastMathTestPerformance.java
+++ 
b/src/userguide/java/org/apache/commons/math4/userguide/JdkMathTestPerformance.java
@@ -16,14 +16,13 @@
  */
 package org.apache.commons.math4.userguide;
 
-import org.apache.commons.math4.PerfTestUtils;
-import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.core.jdkmath.JdkMath;
 
 /**
- * Performance benchmark for FastMath.
+ * Performance benchmark for JdkMath.
  *
  */
-public class FastMathTestPerformance {
+public class JdkMathTestPerformance {
     private static final int RUNS = 
Integer.parseInt(System.getProperty("testRuns","10000000"));
     private static final double F1 = 1d / RUNS;
 
@@ -34,7 +33,7 @@ public class FastMathTestPerformance {
 
     public static void main(String[] args) {
         System.out.println(String.format(FMT_HDR,
-                                         
"Name","StrictMath","FastMath","Math",RUNS,
+                                         
"Name","StrictMath","JdkMath","Math",RUNS,
                                          System.getProperty("java.version"),
                                          
System.getProperty("java.runtime.version","?"),
                                          System.getProperty("java.vm.name"),
@@ -57,7 +56,7 @@ public class FastMathTestPerformance {
         testPow();
         testSin();
         testSinh();
-        testSqrt();
+        // testSqrt(); // Not implemented
         testTan();
         testTanh();
         testIEEEremainder();
@@ -93,7 +92,7 @@ public class FastMathTestPerformance {
         x = 0;
         time = System.nanoTime();
         for (int i = 0; i < RUNS; i++) {
-            x += FastMath.log(0.01 + i);
+            x += JdkMath.log(0.01 + i);
         }
         long fastTime = System.nanoTime() - time;
 
@@ -119,7 +118,7 @@ public class FastMathTestPerformance {
         x = 0;
         time = System.nanoTime();
         for (int i = 0; i < RUNS; i++) {
-            x += FastMath.log10(0.01 + i);
+            x += JdkMath.log10(0.01 + i);
         }
         long fastTime = System.nanoTime() - time;
 
@@ -145,7 +144,7 @@ public class FastMathTestPerformance {
         x = 0;
         time = System.nanoTime();
         for (int i = 0; i < RUNS; i++) {
-            x += FastMath.log1p(-0.9 + i);
+            x += JdkMath.log1p(-0.9 + i);
         }
         long fastTime = System.nanoTime() - time;
 
@@ -171,7 +170,7 @@ public class FastMathTestPerformance {
         x = 0;
         time = System.nanoTime();
         for (int i = 0; i < RUNS; i++) {
-            x += FastMath.pow(0.01 + i * F1, i * F1);
+            x += JdkMath.pow(0.01 + i * F1, i * F1);
         }
         long fastTime = System.nanoTime() - time;
 
@@ -196,7 +195,7 @@ public class FastMathTestPerformance {
         x = 0;
         time = System.nanoTime();
         for (int i = 0; i < RUNS; i++) {
-            x += FastMath.exp(100 * i * F1);
+            x += JdkMath.exp(100 * i * F1);
         }
         long fastTime = System.nanoTime() - time;
 
@@ -222,7 +221,7 @@ public class FastMathTestPerformance {
         x = 0;
         time = System.nanoTime();
         for (int i = 0; i < RUNS; i++) {
-            x += FastMath.sin(100 * (i - RUNS/2) * F1);
+            x += JdkMath.sin(100 * (i - RUNS/2) * F1);
         }
         long fastTime = System.nanoTime() - time;
 
@@ -248,7 +247,7 @@ public class FastMathTestPerformance {
         x = 0;
         time = System.nanoTime();
         for (int i = 0; i < RUNS; i++) {
-            x += FastMath.asin(0.999 * (i - RUNS/2) * F1);
+            x += JdkMath.asin(0.999 * (i - RUNS/2) * F1);
         }
         long fastTime = System.nanoTime() - time;
 
@@ -274,7 +273,7 @@ public class FastMathTestPerformance {
         x = 0;
         time = System.nanoTime();
         for (int i = 0; i < RUNS; i++) {
-            x += FastMath.cos(100 * (i - RUNS/2) * F1);
+            x += JdkMath.cos(100 * (i - RUNS/2) * F1);
         }
         long fastTime = System.nanoTime() - time;
 
@@ -300,7 +299,7 @@ public class FastMathTestPerformance {
         x = 0;
         time = System.nanoTime();
         for (int i = 0; i < RUNS; i++) {
-            x += FastMath.acos(0.999 * (i - RUNS/2) * F1);
+            x += JdkMath.acos(0.999 * (i - RUNS/2) * F1);
         }
         long fastTime = System.nanoTime() - time;
 
@@ -325,7 +324,7 @@ public class FastMathTestPerformance {
         x = 0;
         time = System.nanoTime();
         for (int i = 0; i < RUNS; i++) {
-            x += FastMath.tan(100 * (i - RUNS/2) * F1);
+            x += JdkMath.tan(100 * (i - RUNS/2) * F1);
         }
         long fastTime = System.nanoTime() - time;
 
@@ -351,7 +350,7 @@ public class FastMathTestPerformance {
         x = 0;
         time = System.nanoTime();
         for (int i = 0; i < RUNS; i++) {
-            x += FastMath.atan(100 * (i - RUNS/2) * F1);
+            x += JdkMath.atan(100 * (i - RUNS/2) * F1);
         }
         long fastTime = System.nanoTime() - time;
 
@@ -369,7 +368,7 @@ public class FastMathTestPerformance {
     private static void testAtan2() {
         double x = 0;
         long time = System.nanoTime();
-        int max   = (int) FastMath.floor(FastMath.sqrt(RUNS));
+        int max   = (int) JdkMath.floor(Math.sqrt(RUNS));
         for (int i = 0; i < max; i++) {
             for (int j = 0; j < max; j++) {
                 x += StrictMath.atan2((i - max/2) * (100.0 / max), (j - max/2) 
* (100.0 / max));
@@ -381,7 +380,7 @@ public class FastMathTestPerformance {
         time = System.nanoTime();
         for (int i = 0; i < max; i++) {
             for (int j = 0; j < max; j++) {
-                x += FastMath.atan2((i - max/2) * (100.0 / max), (j - max/2) * 
(100.0 / max));
+                x += JdkMath.atan2((i - max/2) * (100.0 / max), (j - max/2) * 
(100.0 / max));
             }
         }
         long fastTime = System.nanoTime() - time;
@@ -402,7 +401,7 @@ public class FastMathTestPerformance {
     private static void testHypot() {
         double x = 0;
         long time = System.nanoTime();
-        int max   = (int) FastMath.floor(FastMath.sqrt(RUNS));
+        int max   = (int) JdkMath.floor(Math.sqrt(RUNS));
         for (int i = 0; i < max; i++) {
             for (int j = 0; j < max; j++) {
                 x += StrictMath.atan2((i - max/2) * (100.0 / max), (j - max/2) 
* (100.0 / max));
@@ -414,7 +413,7 @@ public class FastMathTestPerformance {
         time = System.nanoTime();
         for (int i = 0; i < max; i++) {
             for (int j = 0; j < max; j++) {
-                x += FastMath.atan2((i - max/2) * (100.0 / max), (j - max/2) * 
(100.0 / max));
+                x += JdkMath.atan2((i - max/2) * (100.0 / max), (j - max/2) * 
(100.0 / max));
             }
         }
         long fastTime = System.nanoTime() - time;
@@ -435,7 +434,7 @@ public class FastMathTestPerformance {
     private static void testIEEEremainder() {
         double x = 0;
         long time = System.nanoTime();
-        int max   = (int) FastMath.floor(FastMath.sqrt(RUNS));
+        int max   = (int) JdkMath.floor(Math.sqrt(RUNS));
         for (int i = 0; i < max; i++) {
             for (int j = 0; j < max; j++) {
                 x += StrictMath.IEEEremainder((i - max/2) * (100.0 / max), (j 
+ 1) * (100.0 / max));
@@ -447,7 +446,7 @@ public class FastMathTestPerformance {
         time = System.nanoTime();
         for (int i = 0; i < max; i++) {
             for (int j = 0; j < max; j++) {
-                x += FastMath.IEEEremainder((i - max/2) * (100.0 / max), (j + 
1) * (100.0 / max));
+                x += JdkMath.IEEEremainder((i - max/2) * (100.0 / max), (j + 
1) * (100.0 / max));
             }
         }
         long fastTime = System.nanoTime() - time;
@@ -476,7 +475,7 @@ public class FastMathTestPerformance {
         x = 0;
         time = System.nanoTime();
         for (int i = 0; i < RUNS; i++) {
-            x += FastMath.cbrt(100 * i * F1);
+            x += JdkMath.cbrt(100 * i * F1);
         }
         long fastTime = System.nanoTime() - time;
 
@@ -491,31 +490,32 @@ public class FastMathTestPerformance {
         assertTrue(!Double.isNaN(x));
     }
 
-    private static void testSqrt() {
-        double x = 0;
-        long time = System.nanoTime();
-        for (int i = 0; i < RUNS; i++) {
-            x += StrictMath.sqrt(100 * i * F1);
-        }
-        long strictTime = System.nanoTime() - time;
-
-        x = 0;
-        time = System.nanoTime();
-        for (int i = 0; i < RUNS; i++) {
-            x += FastMath.sqrt(100 * i * F1);
-        }
-        long fastTime = System.nanoTime() - time;
-
-        x = 0;
-        time = System.nanoTime();
-        for (int i = 0; i < RUNS; i++) {
-            x += Math.sqrt(100 * i * F1);
-        }
-        long mathTime = System.nanoTime() - time;
-
-        report("sqrt",strictTime,fastTime,mathTime);
-        assertTrue(!Double.isNaN(x));
-    }
+    // Function "sqrt" is not implemented in "JdkMath".
+    // private static void testSqrt() {
+    //     double x = 0;
+    //     long time = System.nanoTime();
+    //     for (int i = 0; i < RUNS; i++) {
+    //         x += StrictMath.sqrt(100 * i * F1);
+    //     }
+    //     long strictTime = System.nanoTime() - time;
+
+    //     x = 0;
+    //     time = System.nanoTime();
+    //     for (int i = 0; i < RUNS; i++) {
+    //         x += JdkMath.sqrt(100 * i * F1); // Not implemented
+    //     }
+    //     long fastTime = System.nanoTime() - time;
+
+    //     x = 0;
+    //     time = System.nanoTime();
+    //     for (int i = 0; i < RUNS; i++) {
+    //         x += Math.sqrt(100 * i * F1);
+    //     }
+    //     long mathTime = System.nanoTime() - time;
+
+    //     report("sqrt",strictTime,fastTime,mathTime);
+    //     assertTrue(!Double.isNaN(x));
+    // }
 
     private static void testCosh() {
         double x = 0;
@@ -528,7 +528,7 @@ public class FastMathTestPerformance {
         x = 0;
         time = System.nanoTime();
         for (int i = 0; i < RUNS; i++) {
-            x += FastMath.cosh(100 * (i - RUNS/2) * F1);
+            x += JdkMath.cosh(100 * (i - RUNS/2) * F1);
         }
         long fastTime = System.nanoTime() - time;
 
@@ -554,7 +554,7 @@ public class FastMathTestPerformance {
         x = 0;
         time = System.nanoTime();
         for (int i = 0; i < RUNS; i++) {
-            x += FastMath.sinh(100 * (i - RUNS/2) * F1);
+            x += JdkMath.sinh(100 * (i - RUNS/2) * F1);
         }
         long fastTime = System.nanoTime() - time;
 
@@ -580,7 +580,7 @@ public class FastMathTestPerformance {
         x = 0;
         time = System.nanoTime();
         for (int i = 0; i < RUNS; i++) {
-            x += FastMath.tanh(100 * (i - RUNS/2) * F1);
+            x += JdkMath.tanh(100 * (i - RUNS/2) * F1);
         }
         long fastTime = System.nanoTime() - time;
 
@@ -606,7 +606,7 @@ public class FastMathTestPerformance {
         x = 0;
         time = System.nanoTime();
         for (int i = 0; i < RUNS; i++) {
-            x += FastMath.expm1(100 * (i - RUNS/2) * F1);
+            x += JdkMath.expm1(100 * (i - RUNS/2) * F1);
         }
         long fastTime = System.nanoTime() - time;
 
@@ -631,7 +631,7 @@ public class FastMathTestPerformance {
         x = 0;
         time = System.nanoTime();
         for (int i = 0; i < RUNS; i++) {
-            x += FastMath.abs(i * (1 - 0.5 * RUNS));
+            x += JdkMath.abs(i * (1 - 0.5 * RUNS));
         }
         long fastTime = System.nanoTime() - time;
 
@@ -650,7 +650,7 @@ public class FastMathTestPerformance {
     private static void testSimpleBenchmark() {
         final String SM = "StrictMath";
         final String M = "Math";
-        final String FM = "FastMath";
+        final String FM = "JdkMath";
 
         final int maxWidth = 15;
         final int numStat = 100;
@@ -679,7 +679,7 @@ public class FastMathTestPerformance {
                                     new PerfTestUtils.RunTest(FM) {
                                         @Override
                                         public Double call() throws Exception {
-                                            return FastMath.log(x);
+                                            return JdkMath.log(x);
                                         }
                                     });
 
@@ -703,7 +703,7 @@ public class FastMathTestPerformance {
                                     new PerfTestUtils.RunTest(FM) {
                                         @Override
                                         public Double call() throws Exception {
-                                            return FastMath.log10(x);
+                                            return JdkMath.log10(x);
                                         }
                                     });
 
@@ -727,7 +727,7 @@ public class FastMathTestPerformance {
                                     new PerfTestUtils.RunTest(FM) {
                                         @Override
                                         public Double call() throws Exception {
-                                            return FastMath.log1p(x);
+                                            return JdkMath.log1p(x);
                                         }
                                     });
 
@@ -751,7 +751,7 @@ public class FastMathTestPerformance {
                                     new PerfTestUtils.RunTest(FM) {
                                         @Override
                                         public Double call() throws Exception {
-                                            return FastMath.pow(x, y);
+                                            return JdkMath.pow(x, y);
                                         }
                                     });
 
@@ -775,7 +775,7 @@ public class FastMathTestPerformance {
                                     new PerfTestUtils.RunTest(FM) {
                                         @Override
                                         public Double call() throws Exception {
-                                            return FastMath.exp(x);
+                                            return JdkMath.exp(x);
                                         }
                                     });
 
@@ -799,7 +799,7 @@ public class FastMathTestPerformance {
                                     new PerfTestUtils.RunTest(FM) {
                                         @Override
                                         public Double call() throws Exception {
-                                            return FastMath.sin(x);
+                                            return JdkMath.sin(x);
                                         }
                                     });
 
@@ -823,7 +823,7 @@ public class FastMathTestPerformance {
                                     new PerfTestUtils.RunTest(FM) {
                                         @Override
                                         public Double call() throws Exception {
-                                            return FastMath.asin(x);
+                                            return JdkMath.asin(x);
                                         }
                                     });
 
@@ -847,7 +847,7 @@ public class FastMathTestPerformance {
                                     new PerfTestUtils.RunTest(FM) {
                                         @Override
                                         public Double call() throws Exception {
-                                            return FastMath.cos(x);
+                                            return JdkMath.cos(x);
                                         }
                                     });
 
@@ -871,7 +871,7 @@ public class FastMathTestPerformance {
                                     new PerfTestUtils.RunTest(FM) {
                                         @Override
                                         public Double call() throws Exception {
-                                            return FastMath.acos(x);
+                                            return JdkMath.acos(x);
                                         }
                                     });
 
@@ -895,7 +895,7 @@ public class FastMathTestPerformance {
                                     new PerfTestUtils.RunTest(FM) {
                                         @Override
                                         public Double call() throws Exception {
-                                            return FastMath.tan(x);
+                                            return JdkMath.tan(x);
                                         }
                                     });
 
@@ -919,7 +919,7 @@ public class FastMathTestPerformance {
                                     new PerfTestUtils.RunTest(FM) {
                                         @Override
                                         public Double call() throws Exception {
-                                            return FastMath.atan(x);
+                                            return JdkMath.atan(x);
                                         }
                                     });
 
@@ -943,7 +943,7 @@ public class FastMathTestPerformance {
                                     new PerfTestUtils.RunTest(FM) {
                                         @Override
                                         public Double call() throws Exception {
-                                            return FastMath.atan2(x, y);
+                                            return JdkMath.atan2(x, y);
                                         }
                                     });
 
@@ -967,7 +967,7 @@ public class FastMathTestPerformance {
                                     new PerfTestUtils.RunTest(FM) {
                                         @Override
                                         public Double call() throws Exception {
-                                            return FastMath.hypot(x, y);
+                                            return JdkMath.hypot(x, y);
                                         }
                                     });
 
@@ -992,7 +992,7 @@ public class FastMathTestPerformance {
                                     new PerfTestUtils.RunTest(FM) {
                                         @Override
                                         public Double call() throws Exception {
-                                            return FastMath.cbrt(x);
+                                            return JdkMath.cbrt(x);
                                         }
                                     });
 
@@ -1016,7 +1016,7 @@ public class FastMathTestPerformance {
                                     new PerfTestUtils.RunTest(FM) {
                                         @Override
                                         public Double call() throws Exception {
-                                            return FastMath.sqrt(x);
+                                            return JdkMath.sqrt(x);
                                         }
                                     });
 
@@ -1040,7 +1040,7 @@ public class FastMathTestPerformance {
                                     new PerfTestUtils.RunTest(FM) {
                                         @Override
                                         public Double call() throws Exception {
-                                            return FastMath.cosh(x);
+                                            return JdkMath.cosh(x);
                                         }
                                     });
 
@@ -1064,7 +1064,7 @@ public class FastMathTestPerformance {
                                     new PerfTestUtils.RunTest(FM) {
                                         @Override
                                         public Double call() throws Exception {
-                                            return FastMath.sinh(x);
+                                            return JdkMath.sinh(x);
                                         }
                                     });
 
@@ -1088,7 +1088,7 @@ public class FastMathTestPerformance {
                                     new PerfTestUtils.RunTest(FM) {
                                         @Override
                                         public Double call() throws Exception {
-                                            return FastMath.tanh(x);
+                                            return JdkMath.tanh(x);
                                         }
                                     });
 
@@ -1112,7 +1112,7 @@ public class FastMathTestPerformance {
                                     new PerfTestUtils.RunTest(FM) {
                                         @Override
                                         public Double call() throws Exception {
-                                            return FastMath.expm1(x);
+                                            return JdkMath.expm1(x);
                                         }
                                     });
 
@@ -1136,7 +1136,7 @@ public class FastMathTestPerformance {
                                     new PerfTestUtils.RunTest(FM) {
                                         @Override
                                         public Double call() throws Exception {
-                                            return FastMath.abs(x);
+                                            return JdkMath.abs(x);
                                         }
                                     });
     }
diff --git 
a/src/userguide/java/org/apache/commons/math4/userguide/LowDiscrepancyGeneratorComparison.java
 
b/src/userguide/java/org/apache/commons/math4/userguide/LowDiscrepancyGeneratorComparison.java
index b3174e1f1..62f4489c0 100644
--- 
a/src/userguide/java/org/apache/commons/math4/userguide/LowDiscrepancyGeneratorComparison.java
+++ 
b/src/userguide/java/org/apache/commons/math4/userguide/LowDiscrepancyGeneratorComparison.java
@@ -27,6 +27,7 @@ import java.awt.RenderingHints;
 import java.awt.geom.Rectangle2D;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.function.Supplier;
 
 import javax.swing.JComponent;
 import javax.swing.JLabel;
@@ -36,13 +37,10 @@ import org.apache.commons.rng.UniformRandomProvider;
 import org.apache.commons.rng.simple.RandomSource;
 
 import org.apache.commons.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math4.random.HaltonSequenceGenerator;
-import org.apache.commons.math4.random.RandomVectorGenerator;
-import org.apache.commons.math4.random.SobolSequenceGenerator;
-import org.apache.commons.math4.random.UncorrelatedRandomVectorGenerator;
-import org.apache.commons.math4.random.UniformRandomGenerator;
-import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Pair;
+import org.apache.commons.math4.legacy.random.HaltonSequenceGenerator;
+import org.apache.commons.math4.legacy.random.SobolSequenceGenerator;
+import org.apache.commons.math4.core.jdkmath.JdkMath;
+import org.apache.commons.math4.legacy.core.Pair;
 import org.apache.commons.math4.userguide.ExampleUtils.ExampleFrame;
 
 /**
@@ -50,10 +48,10 @@ import 
org.apache.commons.math4.userguide.ExampleUtils.ExampleFrame;
  */
 public class LowDiscrepancyGeneratorComparison {
 
-    public static List<Vector2D> makeCircle(int samples, final 
RandomVectorGenerator generator) {
+    public static List<Vector2D> makeCircle(int samples, final 
Supplier<double[]> generator) {
         List<Vector2D> points = new ArrayList<>();
         for (double i = 0; i < samples; i++) {
-            double[] vector = generator.nextVector();
+            double[] vector = generator.get();
             Vector2D point = Vector2D.of(vector);
             points.add(point);
         }
@@ -64,7 +62,7 @@ public class LowDiscrepancyGeneratorComparison {
         // now test if the sample is within the unit circle
         List<Vector2D> circlePoints = new ArrayList<>();
         for (Vector2D p : points) {
-            double criteria = FastMath.pow(p.getX(), 2) + 
FastMath.pow(p.getY(), 2);
+            double criteria = JdkMath.pow(p.getX(), 2) + JdkMath.pow(p.getY(), 
2);
             if (criteria < 1.0) {
                 circlePoints.add(p);
             }
@@ -73,10 +71,10 @@ public class LowDiscrepancyGeneratorComparison {
         return circlePoints;
     }
 
-    public static List<Vector2D> makeRandom(int samples, RandomVectorGenerator 
generator) {
+    public static List<Vector2D> makeRandom(int samples, Supplier<double[]> 
generator) {
         List<Vector2D> points = new ArrayList<>();
         for (double i = 0; i < samples; i++) {
-            double[] vector = generator.nextVector();
+            double[] vector = generator.get();
             Vector2D point = Vector2D.of(vector);
             points.add(point);
         }
@@ -89,19 +87,19 @@ public class LowDiscrepancyGeneratorComparison {
         double minX = Double.MAX_VALUE;
         double maxX = Double.MIN_VALUE;
         for (Vector2D p : input) {
-            minX = FastMath.min(minX, p.getX());
-            maxX = FastMath.max(maxX, p.getX());
+            minX = JdkMath.min(minX, p.getX());
+            maxX = JdkMath.max(maxX, p.getX());
         }
 
         double minY, maxY;
 
         // use the minimum to detect if we either have input values in the 
range [0, 1] or [-sqrt(3), sqrt(3)]
-        if (FastMath.abs(minX) < 0.1) {
+        if (JdkMath.abs(minX) < 0.1) {
             minX = minY = 0.0;
             maxX = maxY = 1.0;
         } else {
-            minX = minY = -FastMath.sqrt(3);
-            maxX = maxY = FastMath.sqrt(3);
+            minX = minY = -JdkMath.sqrt(3);
+            maxX = maxY = JdkMath.sqrt(3);
         }
 
         double rangeX = maxX - minX;
@@ -127,18 +125,17 @@ public class LowDiscrepancyGeneratorComparison {
             setLayout(new GridBagLayout());
 
             int[] datasets = new int[] { 256, 1000, 2500, 1000 };
-            List<Pair<String, RandomVectorGenerator>> generators = new 
ArrayList<Pair<String, RandomVectorGenerator>>();
+            List<Pair<String, ? extends Supplier<double[]>>> generators = new 
ArrayList<>();
 
-            generators.add(new Pair<>("Uncorrelated\nUniform(JDK)",
-                                      new UncorrelatedRandomVectorGenerator(2, 
new UniformRandomGenerator(RandomSource.create(RandomSource.JDK)))));
-            generators.add(new Pair<>("Independent\nRandom(MT)", new 
RandomVectorGenerator() {
+            generators.add(new Pair<>("Independent\nRandom(MT)", new 
Supplier<double[]>() {
 
                 final UniformRandomProvider[] rngs = new 
UniformRandomProvider[] {
                     RandomSource.create(RandomSource.MT, 123456789),
                     RandomSource.create(RandomSource.MT, 987654321)
                 };
 
-                public double[] nextVector() {
+                @Override
+                public double[] get() {
                     final double[] vector = new double[2];
                     vector[0] = rngs[0].nextDouble();
                     vector[1] = rngs[1].nextDouble();
@@ -155,7 +152,7 @@ public class LowDiscrepancyGeneratorComparison {
             c.gridy = 0;
             c.insets = new Insets(2, 2, 2, 2);
 
-            for (Pair<String, RandomVectorGenerator> pair : generators) {
+            for (Pair<String, ? extends Supplier<double[]>> pair : generators) 
{
                 JTextArea text = new JTextArea(pair.getFirst());
                 text.setEditable(false);
                 text.setOpaque(false);
@@ -176,7 +173,7 @@ public class LowDiscrepancyGeneratorComparison {
             for (int type = 0; type < 4; type++) {
                 c.gridx = 1;
 
-                for (Pair<String, RandomVectorGenerator> pair : generators) {
+                for (Pair<String, ? extends Supplier<double[]>> pair : 
generators) {
                     List<Vector2D> points = null;
                     int samples = datasets[type];
                     switch (type) {
diff --git 
a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/PerfTestUtils.java
 b/src/userguide/java/org/apache/commons/math4/userguide/PerfTestUtils.java
similarity index 99%
rename from 
commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/PerfTestUtils.java
rename to 
src/userguide/java/org/apache/commons/math4/userguide/PerfTestUtils.java
index 6317b3c38..0dee7f989 100644
--- 
a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/PerfTestUtils.java
+++ b/src/userguide/java/org/apache/commons/math4/userguide/PerfTestUtils.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math4.legacy;
+package org.apache.commons.math4.userguide;
 
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
@@ -53,7 +53,7 @@ public final class PerfTestUtils {
     /** Default number of code repeats for computing the average run time. */
     private static final int DEFAULT_REPEAT_STAT = 10000;
     /** RNG. */
-    private static UniformRandomProvider rng = 
RandomSource.WELL_19937_C.create();
+    private static UniformRandomProvider rng = 
RandomSource.create(RandomSource.WELL_19937_C);
 
     /** No instances. */
     private PerfTestUtils() {}
diff --git 
a/src/userguide/java/org/apache/commons/math4/userguide/filter/CannonballExample.java
 
b/src/userguide/java/org/apache/commons/math4/userguide/filter/CannonballExample.java
index f0a5b14fe..f1cc48d63 100644
--- 
a/src/userguide/java/org/apache/commons/math4/userguide/filter/CannonballExample.java
+++ 
b/src/userguide/java/org/apache/commons/math4/userguide/filter/CannonballExample.java
@@ -27,17 +27,17 @@ import javax.swing.JPanel;
 
 import org.apache.commons.rng.UniformRandomProvider;
 import org.apache.commons.rng.simple.RandomSource;
-
-import org.apache.commons.math4.filter.DefaultMeasurementModel;
-import org.apache.commons.math4.filter.DefaultProcessModel;
-import org.apache.commons.math4.filter.KalmanFilter;
-import org.apache.commons.math4.filter.MeasurementModel;
-import org.apache.commons.math4.filter.ProcessModel;
-import org.apache.commons.math4.linear.MatrixUtils;
-import org.apache.commons.math4.linear.RealMatrix;
-import org.apache.commons.math4.linear.RealVector;
-import org.apache.commons.math4.random.GaussianRandomGenerator;
-import org.apache.commons.math4.util.FastMath;
+import 
org.apache.commons.rng.sampling.distribution.BoxMullerNormalizedGaussianSampler;
+
+import org.apache.commons.math4.legacy.filter.DefaultMeasurementModel;
+import org.apache.commons.math4.legacy.filter.DefaultProcessModel;
+import org.apache.commons.math4.legacy.filter.KalmanFilter;
+import org.apache.commons.math4.legacy.filter.MeasurementModel;
+import org.apache.commons.math4.legacy.filter.ProcessModel;
+import org.apache.commons.math4.legacy.linear.MatrixUtils;
+import org.apache.commons.math4.legacy.linear.RealMatrix;
+import org.apache.commons.math4.legacy.linear.RealVector;
+import org.apache.commons.math4.core.jdkmath.JdkMath;
 import org.apache.commons.math4.userguide.ExampleUtils;
 import org.apache.commons.math4.userguide.ExampleUtils.ExampleFrame;
 
@@ -61,21 +61,21 @@ public class CannonballExample {
         private final double timeslice;
         private final double measurementNoise;
 
-        private final GaussianRandomGenerator rng;
+        private final BoxMullerNormalizedGaussianSampler rng;
 
         public Cannonball(double timeslice, double angle, double 
initialVelocity, double measurementNoise, int seed) {
             this.timeslice = timeslice;
 
-            final double angleInRadians = FastMath.toRadians(angle);
+            final double angleInRadians = JdkMath.toRadians(angle);
             this.velocity = new double[] {
-                    initialVelocity * FastMath.cos(angleInRadians),
-                    initialVelocity * FastMath.sin(angleInRadians)
+                    initialVelocity * JdkMath.cos(angleInRadians),
+                    initialVelocity * JdkMath.sin(angleInRadians)
             };
 
             this.location = new double[] { 0, 0 };
 
             this.measurementNoise = measurementNoise;
-            this.rng = new 
GaussianRandomGenerator(RandomSource.create(RandomSource.WELL_19937_C, seed));
+            this.rng = new 
BoxMullerNormalizedGaussianSampler(RandomSource.create(RandomSource.WELL_19937_C,
 seed));
         }
 
         public double getX() {
@@ -87,11 +87,11 @@ public class CannonballExample {
         }
 
         public double getMeasuredX() {
-            return location[0] + rng.nextNormalizedDouble() * measurementNoise;
+            return location[0] + rng.sample() * measurementNoise;
         }
 
         public double getMeasuredY() {
-            return location[1] + rng.nextNormalizedDouble() * measurementNoise;
+            return location[1] + rng.sample() * measurementNoise;
         }
 
         public double getXVelocity() {
diff --git 
a/src/userguide/java/org/apache/commons/math4/userguide/filter/ConstantVoltageExample.java
 
b/src/userguide/java/org/apache/commons/math4/userguide/filter/ConstantVoltageExample.java
index af9d544c1..55adc88ad 100644
--- 
a/src/userguide/java/org/apache/commons/math4/userguide/filter/ConstantVoltageExample.java
+++ 
b/src/userguide/java/org/apache/commons/math4/userguide/filter/ConstantVoltageExample.java
@@ -27,17 +27,17 @@ import javax.swing.JPanel;
 
 import org.apache.commons.rng.UniformRandomProvider;
 import org.apache.commons.rng.simple.RandomSource;
-
-import org.apache.commons.math4.filter.DefaultMeasurementModel;
-import org.apache.commons.math4.filter.DefaultProcessModel;
-import org.apache.commons.math4.filter.KalmanFilter;
-import org.apache.commons.math4.filter.MeasurementModel;
-import org.apache.commons.math4.filter.ProcessModel;
-import org.apache.commons.math4.linear.Array2DRowRealMatrix;
-import org.apache.commons.math4.linear.ArrayRealVector;
-import org.apache.commons.math4.linear.RealMatrix;
-import org.apache.commons.math4.linear.RealVector;
-import org.apache.commons.math4.random.GaussianRandomGenerator;
+import 
org.apache.commons.rng.sampling.distribution.BoxMullerNormalizedGaussianSampler;
+
+import org.apache.commons.math4.legacy.filter.DefaultMeasurementModel;
+import org.apache.commons.math4.legacy.filter.DefaultProcessModel;
+import org.apache.commons.math4.legacy.filter.KalmanFilter;
+import org.apache.commons.math4.legacy.filter.MeasurementModel;
+import org.apache.commons.math4.legacy.filter.ProcessModel;
+import org.apache.commons.math4.legacy.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.legacy.linear.ArrayRealVector;
+import org.apache.commons.math4.legacy.linear.RealMatrix;
+import org.apache.commons.math4.legacy.linear.RealVector;
 import org.apache.commons.math4.userguide.ExampleUtils;
 import org.apache.commons.math4.userguide.ExampleUtils.ExampleFrame;
 
@@ -57,7 +57,7 @@ public class ConstantVoltageExample {
         private final double initialVoltage;
         private final double processNoise;
         private final double measurementNoise;
-        private final GaussianRandomGenerator rng;
+        private final BoxMullerNormalizedGaussianSampler rng;
 
         private double voltage;
 
@@ -66,7 +66,7 @@ public class ConstantVoltageExample {
             this.voltage = voltage;
             this.processNoise = processNoise;
             this.measurementNoise = measurementNoise;
-            rng = new 
GaussianRandomGenerator(RandomSource.create(RandomSource.WELL_19937_C, seed));
+            rng = new 
BoxMullerNormalizedGaussianSampler(RandomSource.create(RandomSource.WELL_19937_C,
 seed));
         }
 
         /**
@@ -79,12 +79,12 @@ public class ConstantVoltageExample {
         }
 
         public double getMeasuredVoltage() {
-            return getVoltage() + rng.nextNormalizedDouble() * 
measurementNoise;
+            return getVoltage() + rng.sample() * measurementNoise;
         }
 
         public void step() {
             // we apply only the process noise
-            voltage = initialVoltage + rng.nextNormalizedDouble() * 
processNoise;
+            voltage = initialVoltage + rng.sample() * processNoise;
         }
     }
 
diff --git 
a/src/userguide/java/org/apache/commons/math4/userguide/genetics/HelloWorldExample.java
 
b/src/userguide/java/org/apache/commons/math4/userguide/genetics/HelloWorldExample.java
index a47c494a0..9784143d0 100644
--- 
a/src/userguide/java/org/apache/commons/math4/userguide/genetics/HelloWorldExample.java
+++ 
b/src/userguide/java/org/apache/commons/math4/userguide/genetics/HelloWorldExample.java
@@ -23,18 +23,18 @@ import java.util.List;
 
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.commons.math4.exception.util.LocalizedFormats;
-import org.apache.commons.math4.genetics.AbstractListChromosome;
-import org.apache.commons.math4.genetics.Chromosome;
-import org.apache.commons.math4.genetics.ElitisticListPopulation;
-import org.apache.commons.math4.genetics.GeneticAlgorithm;
-import org.apache.commons.math4.genetics.InvalidRepresentationException;
-import org.apache.commons.math4.genetics.MutationPolicy;
-import org.apache.commons.math4.genetics.OnePointCrossover;
-import org.apache.commons.math4.genetics.Population;
-import org.apache.commons.math4.genetics.StoppingCondition;
-import org.apache.commons.math4.genetics.TournamentSelection;
-import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.legacy.exception.util.LocalizedFormats;
+import org.apache.commons.math4.legacy.genetics.AbstractListChromosome;
+import org.apache.commons.math4.legacy.genetics.Chromosome;
+import org.apache.commons.math4.legacy.genetics.ElitisticListPopulation;
+import org.apache.commons.math4.legacy.genetics.GeneticAlgorithm;
+import org.apache.commons.math4.legacy.genetics.InvalidRepresentationException;
+import org.apache.commons.math4.legacy.genetics.MutationPolicy;
+import org.apache.commons.math4.legacy.genetics.OnePointCrossover;
+import org.apache.commons.math4.legacy.genetics.Population;
+import org.apache.commons.math4.legacy.genetics.StoppingCondition;
+import org.apache.commons.math4.legacy.genetics.TournamentSelection;
+import org.apache.commons.math4.core.jdkmath.JdkMath;
 import org.apache.commons.numbers.core.Precision;
 
 public class HelloWorldExample {
@@ -132,7 +132,7 @@ public class HelloWorldExample {
             for (int i = 0, c = target.length(); i < c; i++) {
                 // subtract the ascii difference between the target character 
and the chromosome character.
                 // Thus 'c' is fitter than 'd' when compared to 'a'.
-                f -= FastMath.abs(target.charAt(i) - 
chromosome.get(i).charValue());
+                f -= JdkMath.abs(target.charAt(i) - 
chromosome.get(i).charValue());
             }
             return f;
         }
diff --git 
a/src/userguide/java/org/apache/commons/math4/userguide/genetics/ImageEvolutionExample.java
 
b/src/userguide/java/org/apache/commons/math4/userguide/genetics/ImageEvolutionExample.java
index ed88b3f5e..252ff96de 100644
--- 
a/src/userguide/java/org/apache/commons/math4/userguide/genetics/ImageEvolutionExample.java
+++ 
b/src/userguide/java/org/apache/commons/math4/userguide/genetics/ImageEvolutionExample.java
@@ -35,12 +35,12 @@ import javax.swing.ImageIcon;
 import javax.swing.JButton;
 import javax.swing.JLabel;
 
-import org.apache.commons.math4.genetics.Chromosome;
-import org.apache.commons.math4.genetics.ElitisticListPopulation;
-import org.apache.commons.math4.genetics.GeneticAlgorithm;
-import org.apache.commons.math4.genetics.Population;
-import org.apache.commons.math4.genetics.TournamentSelection;
-import org.apache.commons.math4.genetics.UniformCrossover;
+import org.apache.commons.math4.legacy.genetics.Chromosome;
+import org.apache.commons.math4.legacy.genetics.ElitisticListPopulation;
+import org.apache.commons.math4.legacy.genetics.GeneticAlgorithm;
+import org.apache.commons.math4.legacy.genetics.Population;
+import org.apache.commons.math4.legacy.genetics.TournamentSelection;
+import org.apache.commons.math4.legacy.genetics.UniformCrossover;
 import org.apache.commons.math4.userguide.ExampleUtils;
 import org.apache.commons.math4.userguide.ExampleUtils.ExampleFrame;
 
diff --git 
a/src/userguide/java/org/apache/commons/math4/userguide/genetics/Polygon.java 
b/src/userguide/java/org/apache/commons/math4/userguide/genetics/Polygon.java
index 04f8ad212..58bbcf1ee 100644
--- 
a/src/userguide/java/org/apache/commons/math4/userguide/genetics/Polygon.java
+++ 
b/src/userguide/java/org/apache/commons/math4/userguide/genetics/Polygon.java
@@ -23,8 +23,8 @@ import java.awt.geom.GeneralPath;
 import org.apache.commons.rng.UniformRandomProvider;
 import org.apache.commons.rng.simple.RandomSource;
 
-import org.apache.commons.math4.genetics.GeneticAlgorithm;
-import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.legacy.genetics.GeneticAlgorithm;
+import org.apache.commons.math4.core.jdkmath.JdkMath;
 
 /**
  * Represents a fixed size polgon with its fill color.
@@ -60,7 +60,7 @@ public class Polygon {
         p.data[0] = random.nextFloat(); // r
         p.data[1] = random.nextFloat(); // g
         p.data[2] = random.nextFloat(); // b
-        p.data[3] = FastMath.max(0.2f, random.nextFloat() * 
random.nextFloat()); // a
+        p.data[3] = JdkMath.max(0.2f, random.nextFloat() * 
random.nextFloat()); // a
 
         float px = random.nextFloat();
         float py = random.nextFloat();
diff --git 
a/src/userguide/java/org/apache/commons/math4/userguide/genetics/PolygonChromosome.java
 
b/src/userguide/java/org/apache/commons/math4/userguide/genetics/PolygonChromosome.java
index dc0aa05e2..548cf14f6 100644
--- 
a/src/userguide/java/org/apache/commons/math4/userguide/genetics/PolygonChromosome.java
+++ 
b/src/userguide/java/org/apache/commons/math4/userguide/genetics/PolygonChromosome.java
@@ -24,9 +24,9 @@ import java.awt.image.BufferedImage;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math4.genetics.AbstractListChromosome;
-import org.apache.commons.math4.genetics.Chromosome;
-import org.apache.commons.math4.genetics.InvalidRepresentationException;
+import org.apache.commons.math4.legacy.genetics.AbstractListChromosome;
+import org.apache.commons.math4.legacy.genetics.Chromosome;
+import org.apache.commons.math4.legacy.genetics.InvalidRepresentationException;
 
 /**
  * A simple chromosome representing a list of polygons.
diff --git 
a/src/userguide/java/org/apache/commons/math4/userguide/genetics/RandomPolygonMutation.java
 
b/src/userguide/java/org/apache/commons/math4/userguide/genetics/RandomPolygonMutation.java
index 6f99e598f..fee238ea8 100644
--- 
a/src/userguide/java/org/apache/commons/math4/userguide/genetics/RandomPolygonMutation.java
+++ 
b/src/userguide/java/org/apache/commons/math4/userguide/genetics/RandomPolygonMutation.java
@@ -19,8 +19,8 @@ package org.apache.commons.math4.userguide.genetics;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math4.genetics.Chromosome;
-import org.apache.commons.math4.genetics.MutationPolicy;
+import org.apache.commons.math4.legacy.genetics.Chromosome;
+import org.apache.commons.math4.legacy.genetics.MutationPolicy;
 
 public class RandomPolygonMutation implements MutationPolicy {
 
diff --git a/src/userguide/pom.xml b/src/userguide/pom.xml
index bed7bced4..46b293952 100644
--- a/src/userguide/pom.xml
+++ b/src/userguide/pom.xml
@@ -18,7 +18,7 @@
 <!--
   Stripped down maven pom used for generating example code for the commons 
math userguide.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
https://maven.apache.org/maven-v4_0_0.xsd";>
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.apache.commons</groupId>
   <artifactId>commons-math4-examples</artifactId>
@@ -82,13 +82,7 @@
   <dependencies>
       <dependency>
           <groupId>org.apache.commons</groupId>
-          <artifactId>commons-math4</artifactId>
-          <classifier>tools</classifier>
-          <version>4.0-SNAPSHOT</version>
-      </dependency>
-      <dependency>
-          <groupId>org.apache.commons</groupId>
-          <artifactId>commons-math4</artifactId>
+          <artifactId>commons-math4-legacy</artifactId>
           <version>4.0-SNAPSHOT</version>
       </dependency>
       <dependency>
@@ -114,32 +108,22 @@
       <dependency>
           <groupId>org.apache.commons</groupId>
           <artifactId>commons-rng-client-api</artifactId>
-          <version>1.5</version>
+          <version>1.6</version>
       </dependency>
       <dependency>
           <groupId>org.apache.commons</groupId>
           <artifactId>commons-rng-simple</artifactId>
-          <version>1.3</version>
+          <version>1.6</version>
       </dependency>
       <dependency>
           <groupId>org.apache.commons</groupId>
           <artifactId>commons-geometry-euclidean</artifactId>
           <version>1.0</version>
       </dependency>
-      <dependency>
-          <groupId>org.apache.commons</groupId>
-          <artifactId>commons-geometry-enclosing</artifactId>
-          <version>1.0</version>
-      </dependency>
-      <dependency>
-          <groupId>org.apache.commons</groupId>
-          <artifactId>commons-geometry-hull</artifactId>
-          <version>1.0</version>
-      </dependency>
       <dependency>
           <groupId>org.apache.commons</groupId>
           <artifactId>commons-statistics-distribution</artifactId>
-          <version>1.0</version>
+          <version>1.1</version>
       </dependency>
   </dependencies>
 </project>

Reply via email to