The In surface segregation during the growth of InxGa1-xAs on GaAs(001) has been investigated through a Monte Carlo simulation taking into account the difference between the binding energies of InAs and GaAs and the effect of the epitaxial strain. Photoluminescence energies of quantum-well structures calculated from simulated composition profiles obtained at different temperatures are found to be in good agreement with the experimental ones. It is shown that Monte Carlo simulation is a very powerful way to predict the variation of the In composition profile as a function of growth parameters. It can, moreover, be easily extended to different materials, strain conditions, and surface morphologies.