A method for simulating demographic stochasticity