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

java.lang.Object
  extended by org.apache.mahout.math.function.DoubleFunction
      extended by org.apache.mahout.math.jet.random.AbstractDistribution
All Implemented Interfaces:
IntFunction
Direct Known Subclasses:
AbstractContinousDistribution, AbstractDiscreteDistribution

public abstract class AbstractDistribution
extends DoubleFunction
implements IntFunction


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().
protected  Random getRandomGenerator()
           
abstract  double nextDouble()
          Returns a random number from the distribution.
abstract  int nextInt()
           
protected  double randomDouble()
           
 void setRandomGenerator(Random randomGenerator)
          Sets the uniform random generator internally used.
 
Methods inherited from class org.apache.mahout.math.function.DoubleFunction
isDensifying
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDistribution

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

Method Detail

getRandomGenerator

protected Random getRandomGenerator()

randomDouble

protected double randomDouble()

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 class DoubleFunction
Parameters:
dummy - double for the argument
Returns:
the result of applying the function

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.

setRandomGenerator

public void setRandomGenerator(Random randomGenerator)
Sets the uniform random generator internally used.

Parameters:
randomGenerator - the new PRNG


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.