We obtain a simple direct derivation of the differential equation governing the entropy flow probability distribution function of a stochastic system first obtained by Lebowitz and Spohn. Its solution agrees well with the experimental results of Tietz et al (2006 Phys. Rev. Lett. 97 050602). A trajectory-sampling algorithm allowing us to evaluate the entropy flow distribution function is introduced and discussed. This algorithm turns out to be effective at finite times and in the case of time-dependent transition rates, and is successfully applied to an asymmetric simple exclusion process.