Package org.hipparchus.random
Class AbstractWell.IndexTable
java.lang.Object
org.hipparchus.random.AbstractWell.IndexTable
- Enclosing class:
AbstractWell
Inner class used to store the indirection index table which is fixed
for a given type of WELL class of pseudo-random number generator.
-
Constructor Summary
ConstructorsConstructorDescriptionIndexTable(int k, int m1, int m2, int m3) Creates a new pre-calculated indirection index table. -
Method Summary
Modifier and TypeMethodDescriptionintgetIndexM1(int index) Returns index + M1 modulo the table size.intgetIndexM2(int index) Returns index + M2 modulo the table size.intgetIndexM3(int index) Returns index + M3 modulo the table size.intgetIndexPred(int index) Returns the predecessor of the given index modulo the table size.intgetIndexPred2(int index) Returns the second predecessor of the given index modulo the table size.
-
Constructor Details
-
IndexTable
public IndexTable(int k, int m1, int m2, int m3) Creates a new pre-calculated indirection index table.- Parameters:
k- number of bits in the pool (not necessarily a multiple of 32)m1- first parameter of the algorithmm2- second parameter of the algorithmm3- third parameter of the algorithm
-
-
Method Details
-
getIndexPred
public int getIndexPred(int index) Returns the predecessor of the given index modulo the table size.- Parameters:
index- the index to look at- Returns:
- (index - 1) % table size
-
getIndexPred2
public int getIndexPred2(int index) Returns the second predecessor of the given index modulo the table size.- Parameters:
index- the index to look at- Returns:
- (index - 2) % table size
-
getIndexM1
public int getIndexM1(int index) Returns index + M1 modulo the table size.- Parameters:
index- the index to look at- Returns:
- (index + M1) % table size
-
getIndexM2
public int getIndexM2(int index) Returns index + M2 modulo the table size.- Parameters:
index- the index to look at- Returns:
- (index + M2) % table size
-
getIndexM3
public int getIndexM3(int index) Returns index + M3 modulo the table size.- Parameters:
index- the index to look at- Returns:
- (index + M3) % table size
-