  We here propose a model to capture the complexity of the streamer corona
adjacent to leader stepping and relate it to the production of energetic
electrons serving as a source of X-rays and $\gamma$-rays, manifesting in
terrestrial gamma-ray flashes (TGFs). During its stepping, the leader tip is
accompanied by a corona consisting of multitudinous streamers perturbing the
air in its vicinity and leaving residual charge behind. We explore the relative
importance of air perturbations and preionization on the production of
energetic run-away electrons by 2.5D cylindrical Monte Carlo particle
simulations of streamers in ambient fields of 16 kV cm$^{-1}$ and 50 kV
cm$^{-1}$ at ground pressure. We explore preionization levels between $10^{10}$
m$^{-3}$ and $10^{13}$ m$^{-3}$, channel widths between 0.5 and 1.5 times the
original streamer widths and air perturbation levels between 0\% and 50\% of
ambient air. We observe that streamers in preionized and perturbed air
accelerate more efficiently than in non-ionized and uniform air with air
perturbation dominating the streamer acceleration. We find that in unperturbed
air preionization levels of $10^{11}$ m$^{-3}$ are sufficient to explain
run-away electron rates measured in conjunction with terrestrial gamma-ray
flashes. In perturbed air, the production rate of runaway electrons varies from
$10^{10}$ s$^{-1}$ to $10^{17}$ s$^{-1}$ with maximum electron energies from
some hundreds of eV up to some hundreds of keV in fields above and below the
breakdown strength. In the presented simulations the number of runaway
electrons matches with the number of energetic electrons measured in alignment
with the observations of terrestrial gamma-ray flashes. Conclusively, the
complexity of the streamer zone ahead of leader tips allows explaining the
emission of energetic electrons and photons from streamer discharges.
