A simulation approach to Fokker-Planck modelling of lasers and optical amplifiers