Influence of the pumping statistics in lasers and masers