Class AbstractWell.IndexTable
- java.lang.Object
-
- org.apache.commons.rng.core.source32.AbstractWell.IndexTable
-
- Enclosing class:
- AbstractWell
protected static final class AbstractWell.IndexTable extends java.lang.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.
-
-
Field Summary
Fields Modifier and Type Field Description private int[]
i1
Index indirection table giving for each index the value index + m1 taking table size into account.private int[]
i2
Index indirection table giving for each index the value index + m2 taking table size into account.private int[]
i3
Index indirection table giving for each index the value index + m3 taking table size into account.private int[]
iRm1
Index indirection table giving for each index its predecessor taking table size into account.private int[]
iRm2
Index indirection table giving for each index its second predecessor taking table size into account.
-
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.
-
-
-
Field Detail
-
iRm1
private final int[] iRm1
Index indirection table giving for each index its predecessor taking table size into account.
-
iRm2
private final int[] iRm2
Index indirection table giving for each index its second predecessor taking table size into account.
-
i1
private final int[] i1
Index indirection table giving for each index the value index + m1 taking table size into account.
-
i2
private final int[] i2
Index indirection table giving for each index the value index + m2 taking table size into account.
-
i3
private final int[] i3
Index indirection table giving for each index the value index + m3 taking table size into account.
-
-
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
-
-