The Internet of Things (IoT) is expected to count for a large part of the Internet traffic and its impact on the network is still widely unknown. It is therefore essential to study the IoT Traffic in order to characterize its properties and evaluate its performances. In this paper, we propose a novel IoT traffic generator called IoTTGen. We model the IoT traffic and we generate synthetic traffic for smart home and bio-medical IoT environments. We also extracted anomalous IoT traffic from a real dataset and study the IoT traffic properties by computing the entropy value of traffic parameters. Our generator succeeds in capturing the characteristics of the IoT traffic, which can be visually observed on Behavior Shape graphs. Our generator can also serve to describe the main IoT traffic properties and also to detect IoT traffic anomalies.