public class SimuComDefaultRandomNumberGenerator extends Object implements de.uka.ipd.sdq.probfunction.math.IRandomGenerator
RandomStream
as the functions like
LogNormDistFunction
and NormDistFunction
in package
de.uka.ipd.sdq.simucomframework.variables.functions.
This class is optimized for multi-cores, thus speeding up simulation significantly for at least
two cores. Here everything related to random numbers in SimuCom should be then localised,
especially seed initialisation and the multi-threading stuff (which was - as always - deadlock
prone while implementing). Also it locates the dependency to the [0..1] random number generator
to a single place in the source (remember this needs to be changed to get away from GPL code...).Constructor and Description |
---|
SimuComDefaultRandomNumberGenerator(long[] randomSeed) |
Modifier and Type | Method and Description |
---|---|
void |
dispose() |
void |
nextArrayOfDouble(double[] u,
int start,
int n)
Generates n (pseudo)random numbers from the uniform distribution and stores them into the
array u starting at index start.
|
void |
nextArrayOfInt(int i,
int j,
int[] u,
int start,
int n)
Generates n (pseudo)random numbers from the discrete uniform distribution over the integers
{i, i + 1,..., j}, using this stream and stores the result in the array u starting at index
start.
|
double |
nextDouble()
Returns a (pseudo)random number from the uniform distribution over the interval (0, 1), using
this stream, after advancing its state by one step.
|
int |
nextInt(int i,
int j)
Returns a (pseudo)random number from the discrete uniform distribution over the integers {i,
i + 1,..., j}, using this stream.
|
double |
random()
Returns a (pseudo)random number from the uniform distribution over the interval (0, 1), using
this stream, after advancing its state by one step.
|
void |
resetNextSubstream()
does nothing because this implementation does not support any substreams
|
void |
resetStartStream()
does nothing because this implementation does not support any substreams
|
void |
resetStartSubstream()
does nothing because this implementation does not support any substreams
|
public SimuComDefaultRandomNumberGenerator(long[] randomSeed)
public double random()
random
in interface de.uka.ipd.sdq.probfunction.math.IRandomGenerator
public void dispose()
dispose
in interface de.uka.ipd.sdq.probfunction.math.IRandomGenerator
public void nextArrayOfDouble(double[] u, int start, int n)
RandomStream
)u
- - array that will contain the generated uniformsstart
- - starting index, in the array u, to write uniforms fromn
- - number of uniforms to generatepublic void nextArrayOfInt(int i, int j, int[] u, int start, int n)
RandomStream
i
- - smallest integer that can be generatedj
- - greatest integer that can be generatedu
- - array that will contain the generated valuesstart
- - starting index, in the array u, to write integers fromn
- - number of values being generatedpublic double nextDouble()
public int nextInt(int i, int j)
RandomStreamBase
.i
- - smallest integer that can be generatedj
- - greatest integer that can be generatedpublic void resetNextSubstream()
public void resetStartStream()
public void resetStartSubstream()