hydroScalingAPI.util.probability
Class BinaryDistribution

java.lang.Object
  extended by hydroScalingAPI.util.probability.BinaryDistribution
All Implemented Interfaces:
DiscreteDistribution

public class BinaryDistribution
extends java.lang.Object
implements DiscreteDistribution

An implementation of DiscreteDistribution using a binary distribution P(a) = p and P(b)= 1-p

Author:
Ricardo Mantilla

Constructor Summary
BinaryDistribution(int n0, int n1, double p0)
          Creates a new instance of BinaryDistribution
 
Method Summary
static void main(java.lang.String[] args)
          Tests for the class
 int sample()
          Returns a random value that follows a binary distribution
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryDistribution

public BinaryDistribution(int n0,
                          int n1,
                          double p0)
Creates a new instance of BinaryDistribution

Parameters:
n0 - The first possible outcome
n1 - The second possible outcome
p0 - The probability to return the first possible outcome
Method Detail

sample

public int sample()
Returns a random value that follows a binary distribution

Specified by:
sample in interface DiscreteDistribution
Returns:
A random value

main

public static void main(java.lang.String[] args)
Tests for the class

Parameters:
args - the command line arguments


CUENCAS was initially developed by Ricardo Mantilla at the University of Colorado under the supervision of Dr. Vijay K. Gupta. We wish to recognize the support from the National Science Fundation.