public abstract class Distribution extends Reportable
UniformRandomGenerator
,
LinearCongruentialRandomGenerator
Constructor and Description |
---|
Distribution(Model owner,
java.lang.String name,
boolean showInReport,
boolean showInTrace)
Creates a RandomDistribution object which gets its initial seed from the
experiment's seedgenerator.
|
Modifier and Type | Method and Description |
---|---|
void |
changeRandomGenerator(UniformRandomGenerator randomGenerator)
Changes the underlying random generator to the one given as a parameter.
|
Reporter |
createDefaultReporter()
Creates the default reporter associated with this distribution.
|
long |
getInitialSeed()
Returns the seed value since last reset.
|
boolean |
getNonNegative()
Tells if this distribution can return negative samples.
|
long |
getNumSamples()
Returns the number of Samples given by this distribution.
|
boolean |
isAntithetic()
Returns the current status for antithetic random number generation in
this distribution.
|
void |
reset()
Resets the pseudo random generator's seed and the number of samples given
to zero.
|
void |
reset(long newSeed)
Resets the pseudo random generator's seed to the value passed, the number
of samples given to zero and sets antithetic to false for this
distribution.
|
abstract java.lang.Object |
sampleObject()
Convenience method to return the distribution's sample as
Object . |
void |
setAntithetic(boolean newAntiStatus)
Switches this distribution to produce antithetic samples.
|
void |
setNonNegative(boolean newValue)
Sets the nonNegative switch to the given value.
|
void |
setSeed(long newSeed)
Sets the underlying pseudo random number generator's seed to the value
given.
|
getCorrespondingSchedulable, getDescription, getObservations, getReporter, incrementObservations, incrementObservations, reportIsOn, reportOff, reportOn, resetAt, setCorrespondingSchedulable, setDescription, setReporter
current, currentEntity, currentEntityAll, currentEvent, currentModel, currentSimProcess, debugIsOn, debugOff, debugOn, getModel, isExperimentCompatible, isModelCompatible, presentTime, sendDebugNote, sendMessage, sendTraceNote, sendWarning, skipTraceNote, skipTraceNote, traceIsOn, traceOff, traceOn
getName, getQuotedName, toString
public Distribution(Model owner, java.lang.String name, boolean showInReport, boolean showInTrace)
LinearCongruentialRandomGenerator
is used as the underlying
uniform pseudo random number generator for all pseudo random distribution
.owner
- Model : The distribution's ownername
- java.lang.String : The distribution's nameshowInReport
- boolean : Flag to show distribution in reportshowInTrace
- boolean : Flag to show distribution in tracepublic void changeRandomGenerator(UniformRandomGenerator randomGenerator)
randomGenerator
- java.util.Random : the random generator used for creating
distributionspublic Reporter createDefaultReporter()
DistributionReporter
returned as a default implementation of
this method simply reports the distribution's name, number of
observations (samples given), seed and point of simulation time of the
last reset.DistributionReporter
public long getInitialSeed()
public boolean getNonNegative()
true
it returns positive samples onlypublic long getNumSamples()
public boolean isAntithetic()
setAntithetic(boolean)
public void reset()
reset
in class Reportable
public void reset(long newSeed)
reset()
and
a consecutive call to setSeed(long)
.newSeed
- long : new seed to be used by underlying random number
generator after resetpublic abstract java.lang.Object sampleObject()
Object
.
For type safety, method sample()
should be preferred. However,
this method is useful for environments requiring a non-genetic access point
to obtain samples from any distribution.Object
.public void setAntithetic(boolean newAntiStatus)
true
. Antithetic random numbers are used to minimize the
standard deviation of a series of simulation runs. The results of a run
with normal random numbers has to be standardized with the results of a
run using antithetic random numbers, thus doubling the number of samples
needed, but also lowering the standard deviation of the results of that
simulation. See [Page91, p.139].newAntiStatus
- boolean : Parameter true
switches antithetic mode
on, false
switches antithetic mode offpublic void setNonNegative(boolean newValue)
true
the distribution returns positive samples only,
otherwise it also produces negative samples, if possible.newValue
- boolean : If true
the distribution is set to
return positive samples only, otherwise it also produces
negative samples, if possible.public void setSeed(long newSeed)
newSeed
- long : new seed used by underlying pseudo random number
generator