Packages like Mathematica have built in procedures to deal with distributions. The illustrtation for one of the distributed texts was done with the following lines:

Needs["Statistics`DiscreteDistributions`"]
PDFandCDF[distr_]:=Show[GraphicsArray[
      {ListPlot[Table[PDF[distr, n],{n,0,20}],
          DisplayFunction->Identity],
       Plot[CDF[distr, x],{x,0,20},
          DisplayFunction->Identity,
          AxesOrigin->{0.0,0.0}] }],
      DisplayFunction->$DisplayFunction];

Display["!psfix -land>dist01.ps",PDFandCDF[DiscreteUniformDistribution[15]]];
Display["!psfix -land>dist02.ps",PDFandCDF[BinomialDistribution[15,0.4]]];
Display["!psfix -land>dist03.ps",PDFandCDF[GeometricDistribution[0.2]]];
Display["!psfix -land>dist04.ps",PDFandCDF[PoissonDistribution[10.0]]];
Display["!psfix -land>dist05.ps",PDFandCDF[HypergeometricDistribution[15,9,20]]];

The package Statistics`DiscreteDistributions loaded at the beginning of the program contains distributions like

BernoulliDistribution[p] discrete Bernoulli distribution with mean p
BinomialDistribution[n, p] binomial distribution for n trials with prob p
DiscreteUniformDistribution[n] discrete uniform distribution with n states
GeometricDistribution[p] discrete geometric distribution with mean 1/p
HypergeometricDistribution[n, n_succ, n_tot] hypergeometric distribution for n trials with n_succ successes in a population of size n_tot
LogSeriesDistribution[theta] logarithmic series distribution with parameter theta
NegativeBinomialDistribution[r,p] negative binomial distribution for failure count r and probability p
PoissonDistribution[mu] Poisson distribution with mean mu