Skip to main content
. 2014 Jul 8;470(2167):20140036. doi: 10.1098/rspa.2014.0036

Table 2.

The acceptance–rejection algorithm which is used to sample random numbers which are distributed according to the probability distribution πerfc(z), where z(0,). In our simulations, we use constants a1 and a2 given by (2.10).

— Generate a random number ζ1 uniformly distributed in (0,1).
— Compute exponentially distributed random number ζ2 by ζ2=a1log(ζ1).
— Generate a random number ζ3 uniformly distributed in (0,1).
— If ζ1ζ3<a2erfc(ζ2), then choose ζ2 as a sample from the probability distribution πerfc(z). Otherwise, repeat the algorithm.