A method for simulating atrial fibrillation has been developed using the open source simulator ECGSYN (available at physionet.org). In this method episodes of atrial fibrillation are simulated by combining data streams generated by two ECGSYN engines driven from a correlated stochastic process. The underlying process represents atrial activity during atrail fibrillation. This process generates a series of atrial inter-beat intervals with the same statistical properties as those found in real patients with atrial fibrillation. The atrial beats from this process are then selected to be either conducting beats that generate subsequent ventricular activity on nonconducting beats that generate only atrial activity. The intervals for conducting beats are processed by an ECGSYN engine with appropriate parameters to create PQRS and T waves while the non-conducting intervals are processed by a second ECGSYN engine with parameters to generate only P waves. The data streams from the two engines are superimposed to create an artificial atrial fibrillation waveform. This waveform generator has been made into an operator and has been incorporated into a stream based ECG simulator. The simulator uses a timing operator to switch from generating normal ECG morphologies to atrial fibrillation.