Class RandomPivotingStrategy
- java.lang.Object
-
- org.apache.commons.math4.legacy.stat.descriptive.rank.RandomPivotingStrategy
-
- All Implemented Interfaces:
PivotingStrategy
public class RandomPivotingStrategy extends Object implements PivotingStrategy
A strategy of selecting random index between begin and end indices.- Since:
- 3.4
-
-
Constructor Summary
Constructors Constructor Description RandomPivotingStrategy(org.apache.commons.rng.simple.RandomSource randomSource, long seed)Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intpivotIndex(double[] work, int begin, int end)Find pivot index of the array so that partition and Kth element selection can be made.
-
-
-
Constructor Detail
-
RandomPivotingStrategy
public RandomPivotingStrategy(org.apache.commons.rng.simple.RandomSource randomSource, long seed)
Simple constructor.- Parameters:
randomSource- RNG to use for selecting pivot.seed- Seed for initializing the RNG.- Since:
- 4.0
-
-
Method Detail
-
pivotIndex
public int pivotIndex(double[] work, int begin, int end)
Find pivot index of the array so that partition and Kth element selection can be made. A uniform random pivot selection between begin and end indices.- Specified by:
pivotIndexin interfacePivotingStrategy- Parameters:
work- data arraybegin- index of the first element of the sliceend- index after the last element of the slice- Returns:
- The index corresponding to a random uniformly selected value between first and the last indices of the array slice
- Throws:
MathIllegalArgumentException- MathIllegalArgumentException when indices exceeds range
-
-