Function to allocate a population. Used by init_population and init_random population.