## org.apache.mahout.math.jet.random
Class AbstractDistribution

    java.lang.Object
      org.apache.mahout.math.PersistentObject
          org.apache.mahout.math.jet.random.AbstractDistribution

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, org.apache.mahout.math.function.DoubleFunction, IntFunction, UnaryFunction

Direct Known Subclasses:
  AbstractContinousDistribution, AbstractDiscreteDistribution

    public abstract class AbstractDistribution

extends org.apache.mahout.math.PersistentObject
implements UnaryFunction, IntFunction

See Also:
  Serialized Form

Field Summary
`protected java.util.Random` `randomGenerator`

Constructor Summary
`protected` `AbstractDistribution()` Makes this class non instantiable, but still let's others inherit from it.

Method Summary
`double` `apply(double dummy)` Equivalent to `nextDouble()`.
`int` `apply(int dummy)` Equivalent to `nextInt()`.
`java.util.Random` `getRandomGenerator()` Returns the used uniform random number generator;
`abstract double` `nextDouble()` Returns a random number from the distribution.
`abstract int` `nextInt()`
`void` `setRandomGenerator(java.util.Random randomGenerator)` Sets the uniform random generator internally used.

Methods inherited from class org.apache.mahout.math.PersistentObject
`clone`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### randomGenerator

    protected java.util.Random randomGenerator

Constructor Detail

### AbstractDistribution

    protected AbstractDistribution()

  Makes this class non instantiable, but still let's others inherit from it.

Method Detail

### apply

    public double apply(double dummy)

  Equivalent to `nextDouble()`. This has the effect that distributions can now be used as function objects, returning a random number upon function evaluation.

  Specified by:
    `apply` in interface `org.apache.mahout.math.function.DoubleFunction`

### apply

    public int apply(int dummy)

  Equivalent to `nextInt()`. This has the effect that distributions can now be used as function objects, returning a random number upon function evaluation.

  Specified by:
    `apply` in interface `IntFunction`
  Parameters:
    `dummy` - argument passed to the function.
  Returns:
    the result of the function.

### nextDouble

    public abstract double nextDouble()

  Returns a random number from the distribution.

  Returns:
    A new sample from this distribution.

### nextInt

    public abstract int nextInt()

  Returns:
    A random number from the distribution; returns `(int) Math.round(nextDouble())`. Override this method if necessary.

### getRandomGenerator

    public java.util.Random getRandomGenerator()

  Returns the used uniform random number generator;

  Returns:
    The current PRNG underlying this distribution.

### setRandomGenerator

    public void setRandomGenerator(java.util.Random randomGenerator)

  Sets the uniform random generator internally used.

  Parameters:
    `randomGenerator` - the new PRNG

Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.