For a given mean packet loss rate P and average burst length B, the transition probabilities α and β can be calculated from eqns E.3 and E.4. The model is run for as many packets as are to be served, and at each run it is decided whether the packet should be marked as lost or not. To do this, each run is equivalent to running a random number between 0 and 1, and if it is less than the relevant transition probabilities, the packet is marked lost, otherwise it is received safely.
A pseudo code to perform packet loss is given below:
PreviousPacketLost=FALSE; Readln(P,B); α=(1/B); β=P/(B× (1-P)); FOR (number of packets to be transmitted) BEGIN CASE PreviousPacketLoss OF TRUE: IF random <1-α THEN Packet Loss =TRUE; ELSE Packetloss=FALSE; FALSE: IF random <β THEN PacketLoss=TRUE; ELSE Packetloss=FALSE; END