Inverse CDF Method

randVal:=Module[{u,x},
u=RandomReal[];
x=Which[u<0.4,1,u<0.7,2,u<0.9,3,True,4];
Return[x]
]

vals=Table[randVal,1000];
Histogram[vals]

vals=RandomVariate[PoissonDistribution[5],10000];
hist=Histogram[vals,Automatic,"Probability"]

disc=DiscretePlot[((Exp[-5] (5^x))/(x!)),{x,0,15},PlotMarkers->{Automatic,Medium}]

Show[hist,disc]

Queue Simulation

queueSim[]:=Module[{},
queueSize=1;
time=0;
While[queueSize>0,
time+=1;
x=RandomVariate[PoissonDistribution[5]];
queueSize=queueSize+x;
If[queueSize>100,queueSize=100];
y =RandomVariate[PoissonDistribution[5]];
If[y>queueSize,queueSize=0,queueSize = queueSize-y];
(*Print["at time ",time," the queue contains: ",queueSize]*)
];
(*Print["time until the queue is empty: ",time];*)
Return[time]
]

queueSim[]

vals=Table[queueSim[],10000]

Mean[vals]//N

StandardDeviation[vals]//N