Class AbstractWell.IndexTable
java.lang.Object
org.apache.commons.rng.core.source32.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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int[]
Index indirection table giving for each index the value index + m1 taking table size into account.private final int[]
Index indirection table giving for each index the value index + m2 taking table size into account.private final int[]
Index indirection table giving for each index the value index + m3 taking table size into account.private final int[]
Index indirection table giving for each index its predecessor taking table size into account.private final int[]
Index indirection table giving for each index its second predecessor taking table size into account. -
Constructor Summary
ConstructorsConstructorDescriptionIndexTable
(int k, int m1, int m2, int m3) Creates a new pre-calculated indirection index table. -
Method Summary
Modifier and TypeMethodDescriptionint
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.
-
Field Details
-
iRm1
private final int[] iRm1Index indirection table giving for each index its predecessor taking table size into account. -
iRm2
private final int[] iRm2Index indirection table giving for each index its second predecessor taking table size into account. -
i1
private final int[] i1Index indirection table giving for each index the value index + m1 taking table size into account. -
i2
private final int[] i2Index indirection table giving for each index the value index + m2 taking table size into account. -
i3
private final int[] i3Index indirection table giving for each index the value index + m3 taking table size into account.
-
-
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
-