parent
f81e046546
commit
6fc152e417
|
@ -19,7 +19,7 @@ package org.apache.commons.math4.util;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import org.apache.commons.math4.exception.MathIllegalArgumentException;
|
import org.apache.commons.math4.exception.MathIllegalArgumentException;
|
||||||
import org.apache.commons.math4.random.RandomGenerator;
|
import org.apache.commons.math4.rng.UniformRandomProvider;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,12 +32,12 @@ public class RandomPivotingStrategy implements PivotingStrategyInterface, Serial
|
||||||
private static final long serialVersionUID = 20140713L;
|
private static final long serialVersionUID = 20140713L;
|
||||||
|
|
||||||
/** Random generator to use for selecting pivot. */
|
/** Random generator to use for selecting pivot. */
|
||||||
private final RandomGenerator random;
|
private final UniformRandomProvider random;
|
||||||
|
|
||||||
/** Simple constructor.
|
/** Simple constructor.
|
||||||
* @param random random generator to use for selecting pivot
|
* @param random random generator to use for selecting pivot
|
||||||
*/
|
*/
|
||||||
public RandomPivotingStrategy(final RandomGenerator random) {
|
public RandomPivotingStrategy(final UniformRandomProvider random) {
|
||||||
this.random = random;
|
this.random = random;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ import org.apache.commons.math4.exception.MathIllegalArgumentException;
|
||||||
import org.apache.commons.math4.exception.NotANumberException;
|
import org.apache.commons.math4.exception.NotANumberException;
|
||||||
import org.apache.commons.math4.exception.NullArgumentException;
|
import org.apache.commons.math4.exception.NullArgumentException;
|
||||||
import org.apache.commons.math4.exception.OutOfRangeException;
|
import org.apache.commons.math4.exception.OutOfRangeException;
|
||||||
import org.apache.commons.math4.random.Well1024a;
|
|
||||||
import org.apache.commons.math4.rng.RandomSource;
|
import org.apache.commons.math4.rng.RandomSource;
|
||||||
import org.apache.commons.math4.rng.UniformRandomProvider;
|
import org.apache.commons.math4.rng.UniformRandomProvider;
|
||||||
import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
|
import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
|
||||||
|
@ -317,7 +316,7 @@ public class PercentileTest extends UnivariateStatisticAbstractTest{
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAllTechniquesPercentileUsingRandomPivoting() {
|
public void testAllTechniquesPercentileUsingRandomPivoting() {
|
||||||
kthSelector = new KthSelector(new RandomPivotingStrategy(new Well1024a(0x268a7fb4194240f6l)));
|
kthSelector = new KthSelector(new RandomPivotingStrategy(RandomSource.create(RandomSource.WELL_1024_A, 0x268a7fb4194240f6l)));
|
||||||
Assert.assertEquals(RandomPivotingStrategy.class,
|
Assert.assertEquals(RandomPivotingStrategy.class,
|
||||||
getUnivariateStatistic().getPivotingStrategy().getClass());
|
getUnivariateStatistic().getPivotingStrategy().getClass());
|
||||||
checkAllTechniquesPercentile();
|
checkAllTechniquesPercentile();
|
||||||
|
@ -696,7 +695,7 @@ public class PercentileTest extends UnivariateStatisticAbstractTest{
|
||||||
for (final PivotingStrategyInterface strategy : new PivotingStrategyInterface[] {
|
for (final PivotingStrategyInterface strategy : new PivotingStrategyInterface[] {
|
||||||
new MedianOf3PivotingStrategy(),
|
new MedianOf3PivotingStrategy(),
|
||||||
new CentralPivotingStrategy(),
|
new CentralPivotingStrategy(),
|
||||||
new RandomPivotingStrategy(new Well1024a(0xf097c734e4740053l))
|
new RandomPivotingStrategy(RandomSource.create(RandomSource.WELL_1024_A, 0xf097c734e4740053l))
|
||||||
}) {
|
}) {
|
||||||
kthSelector = new KthSelector(strategy);
|
kthSelector = new KthSelector(strategy);
|
||||||
testAllEstimationTechniquesOnly();
|
testAllEstimationTechniquesOnly();
|
||||||
|
|
Loading…
Reference in New Issue