private static Packet RandomPacket() { PacketFactory factory = PacketFactory.GetFactory(); int id = 1 + Rnd.Next(factory.Count() - 1); // Exclusion of the fragmented packet (ID 0) Packet p = factory.CreateInstance <Packet>(id); p.Random(); return(p); }