jhplot.math.num.random
Class BernoulliRandomVariable
- java.lang.Object
-
- jhplot.math.num.random.AbstractDiscreteRandomVariable
-
- jhplot.math.num.random.BernoulliRandomVariable
-
- All Implemented Interfaces:
- DiscreteRandomVariable
public class BernoulliRandomVariable extends AbstractDiscreteRandomVariable
A random variable generator for the Bernoulli distribution.
References:
- Wikipedia contributors, "Bernoulli Distribution," Wikipedia, The Free Encyclopedia, http://en.wikipedia.org/wiki/Bernoulli_distribution
- Since:
- 1.3
-
-
Constructor Summary
Constructors Constructor and Description BernoulliRandomVariable()
Default constructor.BernoulliRandomVariable(double p)
Create a random variable with the given probability of success.BernoulliRandomVariable(double p, RNG source)
Create a random variable with the given probability of success and source generator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description 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.
-
-
-
Constructor Detail
-
BernoulliRandomVariable
public BernoulliRandomVariable()
Default constructor. The probability of success is set to 0.5.
-
BernoulliRandomVariable
public BernoulliRandomVariable(double p)
Create a random variable with the given probability of success.- Parameters:
p
- the probability of success.
-
BernoulliRandomVariable
public BernoulliRandomVariable(double p, RNG source)
Create a random variable with the given probability of success and source generator.- 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.
-
-
DMelt 3.0 © DataMelt by jWork.ORG