 |
Synthia
Generic and flexible data structure generator
|
Go to the documentation of this file.
19 package ca.uqac.lif.synthia.random;
99 protected PoissonInteger(
float lambda,
double c,
double alpha,
double beta,
double k)
114 public void tell(Number lambda)
163 long n = (long) Math.floor(x + 0.5);
170 double lhs = y + Math.log(v / Math.pow(1 + Math.exp(y), 2));
205 for (
long i = n; i > 0; i--)
double nextDouble()
Returns the next pseudorandom, uniformly distributed.
float m_lambda
The λ parameter of the underlying Poisson distribution.
static long factorial(long n)
Computes the factorial of a number.
Interface implemented by pickers whose picking of objects can be altered by external information.
void tell(Number lambda)
Modifies the parameter λ associated to this picker.
PoissonInteger(float lambda, double c, double alpha, double beta, double k)
Creates a new instance of the picker, with pre-computed values for the constants in Cook's algorithm.
PoissonInteger(Number lambda)
Creates a new instance of the picker.
double m_alpha
Value of constant α in Cook's algorithm.
Integer pick()
Picks an object.
double m_beta
Value of constant β in Cook's algorithm.
void reset()
Puts the picker back into its initial state.
Random Duplicate()
Creates a new instance of the class with the exact same internal states that the original one.
double m_k
Value of constant c in Cook's algorithm.
static final transient int s_maxIterations
Maximum number of iterations in Cook's algorithm.
Picks an object based on the value of a random number generator.
int bigPoisson()
Generates a Poisson integer using Cook's algorithm, which is efficient for larger values of λ.
int smallPoisson()
Generates a Poisson integer using Knuth's algorithm, which is efficient for small values of λ.
transient Random m_random
double m_c
Value of constant c in Cook's algorithm.
PoissonInteger duplicate(boolean with_state)
Creates a copy of the picker.
Generates integer numbers following a Poisson distribution.