# Surname extinction simulator.
# Neil Fraser, 2012.  Public domain.

import random

POPULATION_COUNT = 1000
NAMES_COUNT = 100
GENERATIONS = 100

def report(g):
  census = {}
  for n in names:
    census[n] = 0
  for p in population:
    census[p] = census[p] + 1
  text = "%d" % g
  for n in names:
    text = "%s, %d" % (text, census[n])
  print text

def generation():
  random.shuffle(population)
  male_name = None
  for x in range(len(population)):
    if male_name == None:
      male_name = population[x]
    else:
      population[x] = male_name
      male_name = None

names = range(NAMES_COUNT)

population = []
for x in range(POPULATION_COUNT):
  population.append(random.choice(names))

for g in range(GENERATIONS):
  report(g)
  generation()

