Numerous applications—including optical communications, directed energy, remote sensing, and optical tweezing—utilize the principles of statistical optics and optical coherence theory. Simulation of these phenomena is, therefore, critical in the design of new technologies for these and other such applications. For this reason, this tutorial describes how to generate random electromagnetic field instances or realizations consistent with a given or desired cross-spectral density matrix for use in wave optics simulations. This tutorial assumes that the reader has knowledge of the fundamental principles of statistical optics and optical coherence theory. An extensive reference list is provided where the necessary background information can be found. We begin this tutorial with a brief summary of the coherent-mode representation and the superposition rule of stochastic electromagnetic fields as these foundational ideas form the basis of all known synthesis techniques. We then present optical field expressions that apply these concepts before discussing proper sampling and discretization. We finally compare and contrast coherent-mode- and superposition-rule-based synthesis approaches, discussing the pros and cons of each. As an example, we simulate the synthesis and propagation of an electromagnetic partially coherent field from the literature. We compare simulated or sample statistics to theory to verify that we have successfully produced the desired field and are capturing its propagation behaviors. All computer programs, including detailed explanations of the source code, are provided with this tutorial. We conclude with a brief summary.