Refactoring: generator and randomizer extracted into separate classes.