LibRan  0.1
Pseudo-random number distribution generator
Functions
LRpoisson.c File Reference

The Poisson distribution with rate p > 0. More...

#include <math.h>
#include "libran.h"
Include dependency graph for LRpoisson.c:

Go to the source code of this file.

Functions

int LRi_poisson_RAN (LR_obj *o)
 LRi_poisson_RAN(LR_obj *o) - int Poisson distributed variate. Default values: scale m = 1. More...
 
float LRi_poisson_PDF (LR_obj *o, int x)
 LRi_poisson_PDF(LR_obj *o, int x) - Poisson probablity (or mass) distribution function. More...
 
float LRi_poisson_CDF (LR_obj *o, int x)
 LRi_poisson_CDF(LR_obj *o, int x) - Poisson distribution cumulative distribution function. More...
 

Detailed Description

The Poisson distribution with rate p > 0.

The pseudo-random numbers are distributed from the Poisson distribution, which is a discrete distribution describing the number of events occurring in a fixed interval of time.

The attribute p is greater than zero and represents the "rate" of events per unit interval (and need not be integer). Therefore, p is the mean number of events per unit interval.

\begin{eqnarray*} \mbox{PDF}(k) &= \left\{ \begin{array}{ll} 0, & k < 0 \\ \frac{p^k e^{-p}}{k!}, & 0 \le k . \end{array} \right. \\ \\ \mbox{CDF}(k) &= \left\{ \begin{array}{ll} 0, & k < 0 \\ e^{-p} \sum_{n=0}^{k} \frac{p^n}{n!} , & 0 \le k . \end{array} \right. \end{eqnarray*}

The default is $ p = 1 $ and q will be set to $ e^{-p} $ for calculation efficiency. Do not set q when declaring this distribution.

See also
LRerlang.c LRnexp.c
PoissonDistribution.png
The plots show the distribution functions as continuous only to visually connect adjacent values but are actually discrete.

Definition in file LRpoisson.c.

Function Documentation

◆ LRi_poisson_CDF()

float LRi_poisson_CDF ( LR_obj o,
int  x 
)

LRi_poisson_CDF(LR_obj *o, int x) - Poisson distribution cumulative distribution function.

Parameters
oLR_obj object
xvalue
Returns
float CDF at x

Definition at line 116 of file LRpoisson.c.

◆ LRi_poisson_PDF()

float LRi_poisson_PDF ( LR_obj o,
int  x 
)

LRi_poisson_PDF(LR_obj *o, int x) - Poisson probablity (or mass) distribution function.

Parameters
oLR_obj object
xvalue
Returns
float PDF at x

Definition at line 91 of file LRpoisson.c.

◆ LRi_poisson_RAN()

int LRi_poisson_RAN ( LR_obj o)

LRi_poisson_RAN(LR_obj *o) - int Poisson distributed variate. Default values: scale m = 1.

Parameters
oLR_obj object
Returns
int

Definition at line 66 of file LRpoisson.c.