Refactors the generation of the initial array of numbers