  We develop a method for calculating the self-energy of a quantum impurity
coupled to a continuous bath by stochastically generating a distribution of
finite Anderson models that are solved by exact diagonalization, using the
noninteracting local spectral function as a probability distribution for the
sampling. The method enables calculation of the full analytic self-energy and
single-particle Green's function in the complex frequency plane, without
analytic continuation, and can be used for both finite and zero temperature at
arbitrary fillings. Results are in good agreement with imaginary frequency data
from continuous-time quantum Monte Carlo calculations for the single impurity
Anderson model and the two-orbital Hubbard model within dynamical mean field
theory (DMFT) as well as real frequency data for self energy of the single band
Hubbard model within DMFT using numerical renormalization group. The method
should be applicable to a wide range of quantum impurity models and
particularly useful when high-precision real frequency results are sought.

Strongly Correlated Electrons