All Packages Class Hierarchy This Package Previous Next Index
Class simula.random.Bernoulli
java.lang.Object
|
+----simula.random.Generator
|
+----simula.random.Bernoulli
- public class Bernoulli
- extends Generator
This class implements a random generator with a Bernoulli distribution.
It uses the standard random engine of java java.util.Random
as basis.
- See Also:
- Random, Generator
-
Bernoulli(double)
- Creates a new Bernoulli-distributed generator using the current time as
seed and the given success probability to model the distribution.
-
Bernoulli(long, double)
- Creates a new Bernoulli-distributed generator using the given
seed to initialize it and the given success probability to
model it.
-
Bernoulli(RandomEngine, double)
- Creates a new Bernoulli-distributed generator using the given pseudo-random
engine and the given success probability to model the distribution.
-
density(double)
- Returns the value of the density in the given point.
-
draw()
- Draws a boolean value according to the Bernoulli distribution.
-
setParam(double)
- Sets a different parameter for this generator.
-
type()
- Returns the type of the extracted value.
Bernoulli
public Bernoulli(double p)
- Creates a new Bernoulli-distributed generator using the current time as
seed and the given success probability to model the distribution.
- Parameters:
- seed - Seed for the pseudo-random generator.
- p - Parameter for the Bernoulli generator (success probability).
Bernoulli
public Bernoulli(long seed,
double p)
- Creates a new Bernoulli-distributed generator using the given
seed to initialize it and the given success probability to
model it.
- Parameters:
- seed - Seed for the pseudo-random generator.
- p - Parameter for the Bernoulli generator (success probability).
Bernoulli
public Bernoulli(RandomEngine e,
double p)
- Creates a new Bernoulli-distributed generator using the given pseudo-random
engine and the given success probability to model the distribution.
- Parameters:
- e - Pseudo-random engine to use.
- p - Parameter for the Bernoulli generator (success probability).
density
public double density(double x)
- Returns the value of the density in the given point.
- Parameters:
- x - Point to calculate the density of.
- Returns:
- the value of the density in the given point.
draw
public Value draw()
- Draws a boolean value according to the Bernoulli distribution.
- Returns:
- An instance of Value that encapsulates a boolean value.
- Overrides:
- draw in class Generator
- See Also:
- BooleanValue, Value
setParam
public void setParam(double p)
- Sets a different parameter for this generator.
- Parameters:
- p - New success probability.
type
public int type()
- Returns the type of the extracted value.
- Overrides:
- type in class Generator
All Packages Class Hierarchy This Package Previous Next Index