blog.distrib
Class UniformReal

java.lang.Object
  extended by blog.AbstractCondProbDistrib
      extended by blog.distrib.UniformReal
All Implemented Interfaces:
CondProbDistrib

public class UniformReal
extends AbstractCondProbDistrib

Uniform distribution over a range of real numbers [lower, upper). The range is open at the upper end for consistency with Random.nextDouble().


Constructor Summary
UniformReal(java.util.List params)
          Interprets the parameters as a pair of real numbers (lower, upper) and creates a uniform distribution over the range [lower, upper).
 
Method Summary
 double getProb(java.util.List args, java.lang.Object value)
          Returns 1 / (upper - lower) if the given number is in the range of this distribution, otherwise returns zero.
 java.lang.Object sampleVal(java.util.List args, Type childType)
          Returns a sample from this distribution.
 
Methods inherited from class blog.AbstractCondProbDistrib
getLogProb, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UniformReal

public UniformReal(java.util.List params)
Interprets the parameters as a pair of real numbers (lower, upper) and creates a uniform distribution over the range [lower, upper).

Throws:
java.lang.IllegalArgumentException - if params does not consist of exactly two Number objects, or if lower >= upper
Method Detail

getProb

public double getProb(java.util.List args,
                      java.lang.Object value)
Returns 1 / (upper - lower) if the given number is in the range of this distribution, otherwise returns zero. Takes no arguments.

Throws:
java.lang.IllegalArgumentException - if args is non-empty or value is not a Number

sampleVal

public java.lang.Object sampleVal(java.util.List args,
                                  Type childType)
Returns a sample from this distribution.

Throws:
java.lang.IllegalArgumentException - if args is non-empty