This is the traffic generator part of the discrete event simulator I wrote for the EPSRC project OPSnet. It's written in C++, but no C++-specific constructions have been used, so porting to plain C should be very straightforward. Note that the generator uses the Mersenne twister random generator by default. This is implemented in a C++ header file, and will not be portable to plain C The traffic generator generates the packet destination, length and gap width (the time between 2 subsequent packets). The destination is a uniform distribution; the packet length and gap width can be generated using a number of different distributions. There are many variables defined as macros in the header file, you can use them to customise the generator. I think the defaults are reasonable. The traffic_generator_gen_h.pl Perl script will create the header file and compile the source code. Look at the script and the source code for more info. To compile the traffic generator manually: g++ traffic_generator.cc -o traffic_generator