The present work is concerned with the development of a new algorithm for determination of the equilibrium composition of gaseous detonations. The elements balance equations, and the second law of thermodynamics (i.e., the minimization of the Gibbs free energy of products), are used to determine the equilibrium composition of the detonation products. To minimize the Gibbs free energy with traditional deterministic methods one needs to solve a set of highly nonlinear equations. The numerical methods in the existing equilibrium codes suffer from several drawbacks such as the divergence possibility in some equivalent ratios, and the possibility of converging to a local relative minimum in the minimization process. To overcome these drawbacks, a genetic algorithm is presented in the present study. Converging to the global minimum of Gibbs function in all equivalent ratios, and having a reasonable CPU time are the notable aspects of the proposed algorithm.