Created
January 14, 2015 07:20
-
-
Save anonymous/8a484a7c0be9d14a178b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import random | |
n_males = 20000 | |
n_females = 1000 | |
mu, sigma = 0.0, 1.0 | |
random.normalvariate(mu, sigma) | |
males = [(random.normalvariate(mu, sigma), 'm') for i in range(n_males)] | |
females = [(random.normalvariate(mu, sigma), 'w') for i in range(n_females)] | |
population = males + females | |
population.sort(reverse=True) # by descending score, then (w/m) | |
best1000 = population[:1001] | |
top1000_males = sum([1 for (score, sex) in best1000 if sex is 'm']) | |
top1000_females = sum([1 for (score, sex) in best1000 if sex is 'w']) | |
print "top 1000 (m): %s" % top1000_males | |
print "top 1000 (w): %s" % top1000_females |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment