An improved genetic algorithm (GA) is proposed based on the analysis of population diversity within the framework of Markov chain. The chaos operator to combat premature convergence concerning two goals of maintaining diversity in the population and sustaining the convergence capacity of the GA is introduced. In the CHaos Genetic Algorithm (CHGA), the population is recycled dynamically whereas the most highly fit chromosome is intact so as to restore diversity and reserve the best schemata which may belong to the optimal solution. The characters of chaos as well as advanced operators and parameter settings can improve both exploration and exploitation capacities of the algorithm. The results of multimodal function optimization show that CHGA performs simple genetic algorithms and effectively alleviates the problem of premature convergence.