Based on a rate equation model for single-mode two-level lasers, two algorithms for stochastically simulating the dynamics and steady-state behaviour of micro- and nanolasers are described in detail. Both methods lead to steady-state photon numbers and statistics characteristic of lasers, but one of the algorithms is shown to be significantly more efficient. This algorithm, known as Gillespie's first reaction method (FRM), gives up to a thousandfold reduction in computation time compared to earlier algorithms, while also circumventing numerical issues regarding time-increment size and ordering of events. The FRM is used to examine intra-cavity photon distributions, and it is found that the numerical results follow the analytics exactly. Finally, the FRM is applied to a set of slightly altered rate equations, and it is shown that both the analytical and numerical results exhibit features that are typically associated with the presence of strong inter-emitter correlations in nanolasers.