NBody: add maxNumberOfParticles and refactor Generator