The present article proposes an ECG simulator that advances modeling of arrhythmias and noise by introducing time-varying signal characteristics. The simulator is built around a discrete-time Markov chain model for simulating atrial and ventricular arrhythmias of particular relevance when analyzing atrial fibrillation (AF). Each state is associated with statistical information on episode duration and heartbeat characteristics. Statistical, time-varying modeling of muscle noise, motion artifacts, and the influence of respiration is introduced to increase the complexity of simulated ECGs, making the simulator well suited for data augmentation in machine learning. Modeling of how the PQ and QT intervals depend on heart rate is also introduced. The realism of simulated ECGs is assessed by three experienced doctors, showing that simulated ECGs are difficult to distinguish from real ECGs. Simulator usefulness is illustrated in terms of AF detection performance when either simulated or real ECGs are used to train a neural network for signal quality control. The results show that both types of training lead to similar performance.