import random


def init_population(pop_size, gene_values):
    """Initializes population for genetic algorithm
    pop_size    :  Number of individuals in population
    gene_values   :  List of possible values for individuals
    state_length:  The length of each individual"""

    #n_genes = len(gene_names)

    def make_one( ) :
        return [ random.randrange(0, len(gene_values[d]))
                 for d in range( len(gene_values) )  ]

    population = [ make_one() for i in range(pop_size) ]

    return population