refactor NumberGenerator for better readability