refactoring so that i can add a check on the number range before generating