hassearle / comp4320_proj1

0 stars 0 forks source link

USR: Gremlin #6

Open hassearle opened 6 years ago

hassearle commented 6 years ago

Your program must allow the probability of damaged packets to be input as an argument when the program is executed. This packet damage probability is passed to your Gremlin function. You will implement a gremlin function to simulate two possible scenarios in the transmission line: transmission error that cause packet corruption and correct delivery. When the receiving process receive each packet, it first pass the packet to a gremlin function which will randomly determine whether to change (corrupt) some of the bits or pass the packet as it is to the receiving function. The gremlin function uses a randomnumber generator to determine whether to damage a packet or pass the packet as it is to the receiving function.

If it decides to damage a packet, it will decide on how many and which byte to change. The probability that a given packet will be damaged, P(d), is entered as an argument at runtime. If the probability of damaging a packet is .3, then three out of every ten packets will be damaged. If the packet is to be damaged, the probability of changing one byte is .5, the probability of changing two bytes is .3, and the probability of changing 3 bytes is .2. Every byte in the packet is equally likely to be damaged.

The packet is then passed from the gremlin function to the error detection function that will check for errors in the packet.