net.sf.doodleproject.numerics4j.random
Class GeometricRandomVariable

java.lang.Object
  extended by net.sf.doodleproject.numerics4j.random.AbstractDiscreteRandomVariable
      extended by net.sf.doodleproject.numerics4j.random.GeometricRandomVariable
All Implemented Interfaces:
DiscreteRandomVariable

public class GeometricRandomVariable
extends AbstractDiscreteRandomVariable

A random variable generator for the Geometric distribution.

References:

  1. Wikipedia contributors, "Geometric Distribution," Wikipedia, The Free Encyclopedia, http://en.wikipedia.org/wiki/Geometric_distribution

Since:
1.3
Version:
$Revision: 1.4 $ $Date: 2007/11/18 23:51:19 $

Constructor Summary
GeometricRandomVariable()
          Default constructor.
GeometricRandomVariable(double p)
          Create a random variable with the given probability of success.
GeometricRandomVariable(double p, RNG source)
          Create a random variable with the given parameters.
 
Method Summary
 int nextRandomVariable()
          Access the next random variable from this generator.
static int nextRandomVariable(double p, RNG source)
          Access the next random variable using the given generator.
 
Methods inherited from class net.sf.doodleproject.numerics4j.random.AbstractDiscreteRandomVariable
getSource, nextRandomNumber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeometricRandomVariable

public GeometricRandomVariable()
Default constructor. Probability of success is set to 0.5.


GeometricRandomVariable

public GeometricRandomVariable(double p)
Create a random variable with the given probability of success.

Parameters:
p - the probability of success.

GeometricRandomVariable

public GeometricRandomVariable(double p,
                               RNG source)
Create a random variable with the given parameters.

Parameters:
p - the probability of success.
source - the source generator.
Method Detail

nextRandomVariable

public static int nextRandomVariable(double p,
                                     RNG source)
Access the next random variable using the given generator.

Parameters:
p - the probability of success.
source - the source generator.
Returns:
the next random variable.

nextRandomVariable

public int nextRandomVariable()
Access the next random variable from this generator.

Returns:
the next random variable.


Copyright 2004-2004-2007 DoodleProject. All Rights Reserved.