Public Member Functions | |
RanTable (int doubleTableSize, int intTableSize, int aveInt, long index) | |
void | setSeed (long seed) |
double | nextDouble () |
int | nextInteger () |
For very high dimensional functions (eg 5M evaluations of a 1000 dimension function), re-seeding random generators, generating the random numbers and mapping them into the right range on the fly is too slow, even for RanQD1.
This companion class pre-generates the random numbers needed by FractalFunction1D (in turn called by FastFractal) and stores them in lookup tables. Changing the index simply becomes resetting the array index.
This results in a small loss of statistical diversity for a considerable gain in speed, even for quite large tables (eg 16K) since it is only done once for any given function.
The user does not need to access this class directly, all values are set by its owner, such as FractalFunction1D.
Definition at line 30 of file RanTable.java.
RanTable::RanTable | ( | int | doubleTableSize, | |
int | intTableSize, | |||
int | aveInt, | |||
long | index | |||
) | [inline] |
Create the tables and populate with appropriate random values.
doubleTableSize | size of the table for double values | |
intTableSize | size of the table for int values | |
aveInt | average int value, this will be set from the density | |
index | the index or seed for the tables |
Definition at line 47 of file RanTable.java.
double RanTable::nextDouble | ( | ) | [inline] |
Get the next double.
Definition at line 72 of file RanTable.java.
int RanTable::nextInteger | ( | ) | [inline] |
Get the next int
Definition at line 80 of file RanTable.java.
void RanTable::setSeed | ( | long | seed | ) | [inline] |
Reset the seed.
Definition at line 64 of file RanTable.java.