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

java.lang.Object
  extended by org.apache.mahout.math.function.DoubleFunction
      extended by org.apache.mahout.math.jet.random.AbstractDistribution
          extended by org.apache.mahout.math.jet.random.AbstractContinousDistribution
              extended by org.apache.mahout.math.jet.random.Normal
All Implemented Interfaces:
IntFunction

public class Normal
extends AbstractContinousDistribution

Implements a normal distribution specified mean and standard deviation.


Constructor Summary
Normal(double mean, double standardDeviation, Random randomGenerator)
           
 
Method Summary
 double cdf(double x)
          Returns the cumulative distribution function.
 double nextDouble()
          Returns a random number from the distribution.
 double pdf(double x)
          Returns the probability density function.
 void setRandomGenerator(Random randomGenerator)
          Sets the uniform random generator internally used.
 void setState(double mean, double standardDeviation)
          Sets the mean and variance.
 String toString()
          Returns a String representation of the receiver.
 
Methods inherited from class org.apache.mahout.math.jet.random.AbstractContinousDistribution
nextInt
 
Methods inherited from class org.apache.mahout.math.jet.random.AbstractDistribution
apply, apply, getRandomGenerator, randomDouble
 
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, wait, wait, wait
 

Constructor Detail

Normal

public Normal(double mean,
              double standardDeviation,
              Random randomGenerator)
Parameters:
mean - The mean of the resulting distribution.
standardDeviation - The standard deviation of the distribution.
randomGenerator - The random number generator to use. This can be null if you don't need to generate any numbers.
Method Detail

cdf

public double cdf(double x)
Returns the cumulative distribution function.

Overrides:
cdf in class AbstractContinousDistribution

pdf

public double pdf(double x)
Returns the probability density function.

Overrides:
pdf in class AbstractContinousDistribution

nextDouble

public double nextDouble()
Returns a random number from the distribution.

Specified by:
nextDouble in class AbstractDistribution
Returns:
A new sample from this distribution.

setRandomGenerator

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

Overrides:
setRandomGenerator in class AbstractDistribution
Parameters:
randomGenerator - the new PRNG

setState

public final void setState(double mean,
                           double standardDeviation)
Sets the mean and variance.

Parameters:
mean - The new value for the mean.
standardDeviation - The new value for the standard deviation.

toString

public String toString()
Returns a String representation of the receiver.

Overrides:
toString in class Object


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