You may want to consider changing n, p, and f to be a bit more descriptive. Such as populationSize, populationVector, and fitnessVector, or something along these lines. Sure they're a bit longer, but it improves readability by 2000% (actual statistic).