SSF.Util.Random
Class RandomDistribution
java.lang.Object
|
+--cern.colt.PersistentObject
|
+--cern.jet.random.AbstractDistribution
|
+--SSF.Util.Random.RandomDistribution
- All Implemented Interfaces:
- java.lang.Cloneable, cern.colt.function.DoubleFunction, cern.colt.function.IntFunction, java.io.Serializable
- public class RandomDistribution
- extends AbstractDistribution
Simplifying wrapper for AbstractDistribution. A RandomDistribution
simply holds a reference to an AbstractDistribution, to which it
delegates the nextInt() and nextDouble() methods. This allows us
to hide AbstractDistribution from the SSFNet users.
Unfortunately, it also hides the details of the underlying distribution
from the user --- power users may wish to access the underlying
distribution in order to cast it to a known distribution from
the CERN package.
For example, if we have a RandomDistribution whose implementation is
an instance of cern.jet.random.Exponential, we might want to
access ((Exponential)getImplementation()).pdf(x), the probability
distribution function.
- See Also:
- Serialized Form
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RandomDistribution
protected RandomDistribution(AbstractDistribution dist)
getImplementation
public AbstractDistribution getImplementation()
nextDouble
public final double nextDouble()
- Description copied from class:
AbstractDistribution
- Returns a random number from the distribution.
- Specified by:
nextDouble in class AbstractDistribution
nextInt
public final int nextInt()
- Description copied from class:
AbstractDistribution
- Returns a random number from the distribution; returns (int) Math.round(nextDouble()).
Override this method if necessary.
- Overrides:
nextInt in class AbstractDistribution