Use a class to build packet generator. Make an instance of this class. Packet generator generator generates packets and sends to driver using mailbox. Mailboxis is used to connect the packet generator and driver. Packet generator generates the packet and randomizes the packet. Then the packet is put into mailbox. Always check whether the randomization is sucessful and display a message.
CODE: gen.vr class generator{
cfg_drvr cfg;
integer no_of_pkts;
packet cur_packet;