High-redshift sources suffer from magnification or demagnification due to weak gravitational lensing by large-scale structure. One consequence of this is that the distance–redshift relation, in wide use for cosmological tests, suffers lensing-induced scatter which can be quantified by the magnification probability distribution. Predicting this distribution generally requires a method for ray tracing through cosmological N-body simulations. However, standard methods tend to apply the multiple-thin-lens approximation. In an effort to quantify the accuracy of these methods, we develop an innovative code that performs ray tracing without the use of this approximation. The efficiency and accuracy of this computationally challenging approach can be improved by careful choices of numerical parameters; therefore, the results are analysed for the behaviour of the ray-tracing code in the vicinity of Schwarzschild and Navarro–Frenk–White lenses. Preliminary comparisons are drawn with the multiple-lens-plane ray-bundle method in the context of cosmological mass distributions for a source redshift of zs= 0.5.