The mean free path of a particle for a given process, , depends on the medium and cannot be used directly to sample the probability of an interaction in a heterogeneous detector. The number of mean free paths which a particle travels is:
and it is independent of the material traversed. If is a random variable denoting the number of mean free paths from a given point until the point of interaction, it can be shown that has the distribution function
The total number of mean free paths the particle travels before the interaction point, , is sampled at the beginning of the trajectory as:
where is a random number uniformly distributed in the range . is updated after each step according the formula:
until the step originating from is the shortest and this triggers the specific process.