A Monte Carlo (MC) code has been developed to simulate the interaction of gamma-rays with semiconductors and scintillators, and the subsequent energy partitioning of fast electrons. The results provide insights on the processes involved in the electron-hole pair yield and intrinsic variance through simulations of full electron energy cascades. The MC code has been applied to simulate the production of electron-hole pairs and to evaluate intrinsic resolution in a number of semiconductors. In addition, the MC code is also able to consider the spatial distribution of electron-hole pairs induced by photons and electrons in detector materials, and has been employed to obtain details of the spatial distribution of electron-hole pairs in Ge, as a benchmark case. The preliminary results show that the distribution of electron-hole pairs exhibit some important features; (a) the density of electron-hole pairs along the main electron track is very high and (b) most electron-hole pairs produced by interband transitions are distributed at the periphery of the cascade volume. The spatial distribution and density of thermalized electron-hole pairs along the primary and secondary tracks are important for large scale simulations of electron-hole pair transport.