In event-driven algorithms for simulation of diffusing, colliding, and reacting particles, new positions and events are sampled from the cumulative distribution function (CDF) of a probability distribution. The distribution is sampled frequently and it is important for the efficiency of the algorithm that the sampling is fast. The CDF is known analytically or computed numerically. Analytical formulas are sometimes rather complicated making them difficult to evaluate. The CDF may be stored in a table for interpolation or computed directly when it is needed. Different alternatives are compared for chemically reacting molecules moving by Brownian diffusion in two and three dimensions. The best strategy depends on the dimension of the problem, the length of the time interval, the density of the particles, and the number of different reactions.