org.mrd.random
Class Bernoulli

java.lang.Object
  |
  +--cern.colt.PersistentObject
        |
        +--cern.jet.random.AbstractDistribution
              |
              +--cern.jet.random.AbstractContinousDistribution
                    |
                    +--org.mrd.random.Bernoulli
All Implemented Interfaces:
java.lang.Cloneable, cern.colt.function.DoubleFunction, cern.colt.function.IntFunction, java.io.Serializable

public class Bernoulli
extends cern.jet.random.AbstractContinousDistribution

Constructs a Bernoulli Trial with the given successProbability, using a cern.jet.random.engine.MersenneTwister seeded with the given seed.

Version:
0.1
Author:
Mark R. Diggory
See Also:
Serialized Form

Field Summary
protected  double successProbability
           
 
Fields inherited from class cern.jet.random.AbstractDistribution
randomGenerator
 
Fields inherited from class cern.colt.PersistentObject
serialVersionUID
 
Constructor Summary
Bernoulli(double p, int seed)
          Constructs a Bernoulli Trial with the given successProbability, using a cern.jet.random.engine.MersenneTwister seeded with the given seed.
Bernoulli(double p, edu.cornell.lassp.houle.RngPack.RandomElement randomGenerator)
          Constructs a Bernoulli Trial with the given successProbability, using a given Random Generator.
 
Method Summary
 double getSuccessProbability()
           
 boolean nextBoolean()
          Returns a uniformly distributed random boolean.
 double nextDouble()
           
 int nextInt()
           
 void setSuccessProbability(double successProbability)
          Returns a Bernoulli with the propability of success equal to successProbability.
 
Methods inherited from class cern.jet.random.AbstractDistribution
apply, apply, clone, getRandomGenerator, makeDefaultGenerator, setRandomGenerator
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

successProbability

protected double successProbability
Constructor Detail

Bernoulli

public Bernoulli(double p,
                 int seed)
Constructs a Bernoulli Trial with the given successProbability, using a cern.jet.random.engine.MersenneTwister seeded with the given seed.


Bernoulli

public Bernoulli(double p,
                 edu.cornell.lassp.houle.RngPack.RandomElement randomGenerator)
Constructs a Bernoulli Trial with the given successProbability, using a given Random Generator.

Method Detail

nextInt

public int nextInt()
Overrides:
nextInt in class cern.jet.random.AbstractDistribution

nextBoolean

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


nextDouble

public double nextDouble()
Specified by:
nextDouble in class cern.jet.random.AbstractDistribution

setSuccessProbability

public void setSuccessProbability(double successProbability)
                           throws java.lang.IndexOutOfBoundsException
Returns a Bernoulli with the propability of success equal to successProbability.

Throws:
OutOfBoundsException - thrown if successProbability is not between 0 and 1.
java.lang.IndexOutOfBoundsException

getSuccessProbability

public double getSuccessProbability()


Copyright © 2000-2003 Mark Robert Diggory. All Rights Reserved.