import random


def roll(genome, random=random):
    """Randomly produce a set of genes based on the given genome."""
    genes = {}
    for (geneName, gene) in genome.items():
      if hasattr(gene,"roll"):
        genes[geneName] = gene.roll()
      else:
        genes[geneName] = random.choice(gene)
    return genes