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

Constructor Index

 o Bernoulli(double)
Creates a new Bernoulli-distributed generator using the current time as seed and the given success probability to model the distribution.
 o Bernoulli(long, double)
Creates a new Bernoulli-distributed generator using the given seed to initialize it and the given success probability to model it.
 o Bernoulli(RandomEngine, double)
Creates a new Bernoulli-distributed generator using the given pseudo-random engine and the given success probability to model the distribution.

Method Index

 o density(double)
Returns the value of the density in the given point.
 o draw()
Draws a boolean value according to the Bernoulli distribution.
 o setParam(double)
Sets a different parameter for this generator.
 o type()
Returns the type of the extracted value.

Constructors

 o 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).
 o 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).
 o 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).

Methods

 o 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.
 o 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
 o setParam
 public void setParam(double p)
Sets a different parameter for this generator.

Parameters:
p - New success probability.
 o 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