Thunderstorms generate bursts of X- and Gamma radiation. When observed from spacecraft, the bursts are referred to as “Terrestrial Gamma-ray Flashes” (TGFs). They are bremsstrahlung from energetic electrons accelerated in thunderstorm electric _elds. The TGFs were _rst observed in the 90ties at the time when also gigantic electric discharges were observed at 10-90 km altitude in the stratosphere and mesosphere, the so called “jets” and “sprites”, commonly referred to as “Transient Luminous Events” (TLEs). TGFs were _rst thought connected to TLEs, but later research has pointed to lightning discharges as the source. The “Atmosphere-Space Interactions Monitor” (ASIM) for the International Space Station in 2016, led by DTU Space, and the French microsatellite TARANIS, also with launch in 2016, will identify with certainty the source of TGFs. In preparation for the missions, the Ph.D. project has developed a Monte Carlo module of a simulation code to model the formation of avalanches of electrons accelerated to relativistic energies, and the generation of bremsstrahlung through interactions with the neutral atmosphere. The code will be used in the analysis of data from the two space missions. We have studied the electron acceleration and photon generation in a constant electric _eld under a variety of conditions. These include the energy and number of seed electrons, electric_eld and altitude. We found that the distributions of avalanche electrons and photons are insensitive to these conditions, with exception of the electric _eld magnitude where the photon distribution becomes progressively more forward directed for increasing _eld magnitude. However, exploring photon transport to the top of the atmosphere, the angular beaming properties were found to wash out because of Compton scattering. However, we only explored the properties of the complete number of photons reaching space, not the distribution at speci_c locations as in the case of a satellite. With this reservation we conclude that it is not possible to deduce much information from a satellite measurement of the photons alone on the conditions of the source region. With one exception: the spectral hardness increases with altitude of the source, again caused by reduced Compton scattering with altitude. Appling the code to a thunderstorm cloud we further found that an impulsive electric _eld of about 5 times the local breakdown _eld appears plausible for TGF generation, because it minimizes the electron avalanche time and length and the total electric potential required.