Exploring the Initial Mass Function by Stochastically Lighting Up Galaxies