The inverse planning for a step-and-shoot plan in intensity-modulated radiotherapy (IMRT) is usually a multiple step process. Before being converted into the MLC segments, the optimum intensity profiles of beams, which are generated by an optimization algorithm, shall be discretized into a few intensity levels. The discretization process of the optimum intensity profiles can induce deviations in the final dose distribution from the original optimum dose distribution. This paper describes a genetic algorithm for the discretization of given optimum intensity profiles. The algorithm minimizes an objective function written in terms of the intensity levels. Both the dose-based objective function, which is defined by the deviation between the dose distributions before and after the discretization, and the intensity-based objective function, which is defined by the deviation between the optimum intensity profiles and the discretization intensity profiles, have been adopted. To evaluate this algorithm, a series of simulation calculations had been carried out using the present algorithm, the even-spaced discretization and the k-means clustering algorithm respectively. By comparing the resultant discretization-induced deviations (DIDs) in intensity profiles and in dose distributions, we have found that the genetic algorithm induced less DIDs in comparison with that induced in the even-spaced discretization or the k-means clustering algorithm. Additionally, it has been found that the DIDs created in the genetic algorithm correlate with the complexity of the intensity profiles that is measured by the "fluence map complexity".