PoissonDistr

public class PoissonDistr implements ContinuousDistribution

A pseudo random number generator which returns numbers following a Poisson Distribution, modeling the probability of an event to happen a number of times in a given time interval.

Author:Manoel Campos da Silva Filho

See also: Poisson Distribution, Poisson Point Process

Constructors

PoissonDistr

public PoissonDistr(double lambda, long seed)

Creates a new Poisson random number generator to check the probability of 1 event (k) to happen at each time interval.

Parameters:
  • lambda – the average number of events that happen at each 1 time unit. If one considers the unit as minute, this value means the average number of arrivals at each minute.
  • seed – the seed to initialize the uniform random number generator

See also: .setK(int), .setLambda(double)

PoissonDistr

public PoissonDistr(double lambda)

Creates a new Poisson process that considers you want to check the probability of 1 event (k) to happen at each time.

Parameters:
  • lambda – average number of events by interval. For instance, if it was defined 1 event to be expected at each 2.5 minutes, it means that 0.4 event is expected at each minute (1/2.5).

See also: .setK(int)

Methods

eventsArrivalProbability

public double eventsArrivalProbability()

Gets the probability to arrive K events in the current time, considering the expected average arrival time lambda. It computes the Probability Mass Function (PMF) of the Poisson distribution.

See also: Poisson distribution

eventsHappened

public boolean eventsHappened()

Checks if at the current time, K events have happened, considering the probability of these K events to happen in a time interval.

Returns:true if the K events have happened at current time, false otherwise

getInterArrivalMeanTime

public double getInterArrivalMeanTime()

Gets the mean time between arrival of two events, which is the inverse of lambda. The time unit (if seconds, minutes, hours, etc) is the same considered when setting a value to the lambda parameter.

getK

public int getK()

Gets the number of events to check the probability for them to happen in a time interval (default 1).

getLambda

public double getLambda()

Gets the average number of events that are expected to happen at each 1 time unit. It is the expected number of events to happen each time, also called the event rate or rate parameter.

If the unit is minute, this value means the average number of arrivals at each minute. It’s the inverse of the getInterArrivalMeanTime().

getSeed

public long getSeed()

main

public static void main(String[] args)

Tests the simulations of customers arrivals in a Poisson process. All the code inside this method is just to try the class. That is way it declares internal methods as Functional objects, instead of declaring such methods at the class level and just calling them.

Parameters:
  • args

sample

public double sample()

Gets a random number that represents the next time for an event to happen, considering the events arrival rate (lambda).

setK

public void setK(int k)

Sets the number of events to check the probability to happen in a time time.

Parameters:
  • k – the value to set