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

java.lang.Object
  extended by org.apache.mahout.math.PersistentObject
      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.Uniform
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, org.apache.mahout.math.function.DoubleFunction, IntFunction, UnaryFunction

public class Uniform
extends AbstractContinousDistribution

See Also:
Serialized Form

Field Summary
protected static Uniform shared
           
 
Fields inherited from class org.apache.mahout.math.jet.random.AbstractDistribution
randomGenerator
 
Constructor Summary
Uniform(double min, double max, int seed)
          Constructs a uniform distribution with the given minimum and maximum, using a MersenneTwister seeded with the given seed.
Uniform(double min, double max, java.util.Random randomGenerator)
          Constructs a uniform distribution with the given minimum and maximum.
Uniform(java.util.Random randomGenerator)
          Constructs a uniform distribution with min=0.0 and max=1.0.
 
Method Summary
 double cdf(double x)
          Returns the cumulative distribution function (assuming a continous uniform distribution).
 boolean nextBoolean()
          Returns a uniformly distributed random boolean.
 double nextDouble()
          Returns a uniformly distributed random number in the open interval (min,max) (excluding min and max).
 double nextDoubleFromTo(double from, double to)
          Returns a uniformly distributed random number in the open interval (from,to) (excluding from and to).
 float nextFloatFromTo(float from, float to)
          Returns a uniformly distributed random number in the open interval (from,to) (excluding from and to).
 int nextIntFromTo(int from, int to)
          Returns a uniformly distributed random number in the closed interval [from,to] (including from and to).
 long nextLongFromTo(long from, long to)
          Returns a uniformly distributed random number in the closed interval [from,to] (including from and to).
 double pdf(double x)
          Returns the probability distribution function (assuming a continous uniform distribution).
 void setState(double min, double max)
          Sets the internal state.
static boolean staticNextBoolean()
          Returns a uniformly distributed random boolean.
static double staticNextDouble()
          Returns a uniformly distributed random number in the open interval (0,1) (excluding 0 and 1).
static double staticNextDoubleFromTo(double from, double to)
          Returns a uniformly distributed random number in the open interval (from,to) (excluding from and to).
static float staticNextFloatFromTo(float from, float to)
          Returns a uniformly distributed random number in the open interval (from,to) (excluding from and to).
static int staticNextIntFromTo(int from, int to)
          Returns a uniformly distributed random number in the closed interval [from,to] (including from and to).
static long staticNextLongFromTo(long from, long to)
          Returns a uniformly distributed random number in the closed interval [from,to] (including from and to).
 java.lang.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, setRandomGenerator
 
Methods inherited from class org.apache.mahout.math.PersistentObject
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

shared

protected static final Uniform shared
Constructor Detail

Uniform

public Uniform(double min,
               double max,
               int seed)
Constructs a uniform distribution with the given minimum and maximum, using a MersenneTwister seeded with the given seed.


Uniform

public Uniform(double min,
               double max,
               java.util.Random randomGenerator)
Constructs a uniform distribution with the given minimum and maximum.


Uniform

public Uniform(java.util.Random randomGenerator)
Constructs a uniform distribution with min=0.0 and max=1.0.

Method Detail

cdf

public double cdf(double x)
Returns the cumulative distribution function (assuming a continous uniform distribution).

Overrides:
cdf in class AbstractContinousDistribution

nextBoolean

public boolean nextBoolean()
Returns a uniformly distributed random boolean.


nextDouble

public double nextDouble()
Returns a uniformly distributed random number in the open interval (min,max) (excluding min and max).

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

nextDoubleFromTo

public double nextDoubleFromTo(double from,
                               double to)
Returns a uniformly distributed random number in the open interval (from,to) (excluding from and to). Pre conditions: from <= to.


nextFloatFromTo

public float nextFloatFromTo(float from,
                             float to)
Returns a uniformly distributed random number in the open interval (from,to) (excluding from and to). Pre conditions: from <= to.


nextIntFromTo

public int nextIntFromTo(int from,
                         int to)
Returns a uniformly distributed random number in the closed interval [from,to] (including from and to). Pre conditions: from <= to.


nextLongFromTo

public long nextLongFromTo(long from,
                           long to)
Returns a uniformly distributed random number in the closed interval [from,to] (including from and to). Pre conditions: from <= to.


pdf

public double pdf(double x)
Returns the probability distribution function (assuming a continous uniform distribution).

Overrides:
pdf in class AbstractContinousDistribution

setState

public void setState(double min,
                     double max)
Sets the internal state.


staticNextBoolean

public static boolean staticNextBoolean()
Returns a uniformly distributed random boolean.


staticNextDouble

public static double staticNextDouble()
Returns a uniformly distributed random number in the open interval (0,1) (excluding 0 and 1).


staticNextDoubleFromTo

public static double staticNextDoubleFromTo(double from,
                                            double to)
Returns a uniformly distributed random number in the open interval (from,to) (excluding from and to). Pre conditions: from <= to.


staticNextFloatFromTo

public static float staticNextFloatFromTo(float from,
                                          float to)
Returns a uniformly distributed random number in the open interval (from,to) (excluding from and to). Pre conditions: from <= to.


staticNextIntFromTo

public static int staticNextIntFromTo(int from,
                                      int to)
Returns a uniformly distributed random number in the closed interval [from,to] (including from and to). Pre conditions: from <= to.


staticNextLongFromTo

public static long staticNextLongFromTo(long from,
                                        long to)
Returns a uniformly distributed random number in the closed interval [from,to] (including from and to). Pre conditions: from <= to.


toString

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

Overrides:
toString in class java.lang.Object


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