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

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


The following commit(s) were added to refs/heads/master by this push:
     new f3c84f7  RNG-157: Deprecate UnitSphereSampler constructor
f3c84f7 is described below

commit f3c84f761abaa7ca8908eaefa87dd715b7ad1f33
Author: Alex Herbert <aherb...@apache.org>
AuthorDate: Sat Jul 24 07:33:51 2021 +0100

    RNG-157: Deprecate UnitSphereSampler constructor
---
 .../main/java/org/apache/commons/rng/sampling/UnitSphereSampler.java  | 2 ++
 .../java/org/apache/commons/rng/sampling/UnitSphereSamplerTest.java   | 1 +
 src/changes/changes.xml                                               | 4 ++++
 3 files changed, 7 insertions(+)

diff --git 
a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/UnitSphereSampler.java
 
b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/UnitSphereSampler.java
index 53c81f9..a0fa3d5 100644
--- 
a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/UnitSphereSampler.java
+++ 
b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/UnitSphereSampler.java
@@ -218,7 +218,9 @@ public class UnitSphereSampler implements 
SharedStateObjectSampler<double[]> {
      * @param rng Generator for the individual components of the vectors.
      * A shallow copy will be stored in this instance.
      * @throws IllegalArgumentException If {@code dimension <= 0}
+     * @deprecated Use {@link #of(int, UniformRandomProvider)}.
      */
+    @Deprecated
     public UnitSphereSampler(int dimension,
                              UniformRandomProvider rng) {
         delegate = of(dimension, rng);
diff --git 
a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/UnitSphereSamplerTest.java
 
b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/UnitSphereSamplerTest.java
index 3011740..5ba33c4 100644
--- 
a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/UnitSphereSamplerTest.java
+++ 
b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/UnitSphereSamplerTest.java
@@ -36,6 +36,7 @@ public class UnitSphereSamplerTest {
      */
     @Test(expected = IllegalArgumentException.class)
     public void testInvalidDimensionThrows() {
+        // Use instance constructor not factory constructor to exercise 1.X 
public API
         new UnitSphereSampler(0, null);
     }
 
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 777f845..9781dfb 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -77,6 +77,10 @@ re-run tests that fail, and pass the build if they succeed
 within the allotted number of reruns (the test will be marked
 as 'flaky' in the report).
 ">
+      <action dev="aherbert" type="update" issue="157">
+        "UnitSphereSampler": Deprecate public constructor. Use the factory 
constructor to create
+        an optimal sampler.
+      </action>
       <action dev="aherbert" type="add" issue="137">
         New "StableSampler" class to sample from a stable distribution.
       </action>

Reply via email to