Package org.hipparchus.random
Class AbstractWell.IndexTable
- java.lang.Object
-
- org.hipparchus.random.AbstractWell.IndexTable
-
- Enclosing class:
- AbstractWell
protected static final class AbstractWell.IndexTable extends Object
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
Constructors Constructor Description IndexTable(int k, int m1, int m2, int m3)
Creates a new pre-calculated indirection index table.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getIndexM1(int index)
Returns index + M1 modulo the table size.int
getIndexM2(int index)
Returns index + M2 modulo the table size.int
getIndexM3(int index)
Returns index + M3 modulo the table size.int
getIndexPred(int index)
Returns the predecessor of the given index modulo the table size.int
getIndexPred2(int index)
Returns the second predecessor of the given index modulo the table size.
-
-
-
Constructor Detail
-
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 Detail
-
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
-
-