replaced repeated range in run_generation with call to repeated_permutation