nl.tudelft.simulation.jstats.distributions
Class DistBernoulli

java.lang.Object
  extended by nl.tudelft.simulation.jstats.distributions.Dist
      extended by nl.tudelft.simulation.jstats.distributions.DistDiscrete
          extended by nl.tudelft.simulation.jstats.distributions.DistBernoulli
All Implemented Interfaces:
Serializable

public class DistBernoulli
extends DistDiscrete

The Bernouilli distribution. For more information on this distribution see http://mathworld.wolfram.com/BernouilliDistribution.html

(c) copyright 2002-2004 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: Lesser General Public License (LGPL) , no warranty.

Since:
1.2
Version:
$Revision: 1.1 $ $Date: 2007/01/06 13:25:42 $
Author:
Alexander Verbraeck
Peter Jacobs
See Also:
Serialized Form

Field Summary
 
Fields inherited from class nl.tudelft.simulation.jstats.distributions.Dist
stream
 
Constructor Summary
DistBernoulli(StreamInterface stream, double p)
          constructs a new Bernoulli distribution.
 
Method Summary
 long draw()
          draws the next value from the Bernoulli distribution.
 double probability(int observation)
          returns the propbability of the observation in this particular distribution.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DistBernoulli

public DistBernoulli(StreamInterface stream,
                     double p)
constructs a new Bernoulli distribution. Random occurence with two possible outcomes; used to generate other discrete random variates.

Parameters:
stream - is the stream
p - the p-value of a Bernoulli distribution
Method Detail

draw

public long draw()
draws the next value from the Bernoulli distribution. More information on this distribution can be found at < a href="http://mathworld.wolfram.com/BernoulliDistribution.html"> http://mathworld.wolfram.com/BernoulliDistribution.html .

Specified by:
draw in class DistDiscrete
Returns:
the next value {0,1}.

probability

public double probability(int observation)
Description copied from class: DistDiscrete
returns the propbability of the observation in this particular distribution.

Specified by:
probability in class DistDiscrete
Parameters:
observation - the discrete observation.
Returns:
double the probability.
See Also:
#probability(int)

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2002-2011 Delft University of Technology, the Netherlands. All Rights Reserved.