Monte Carlo method for relaxation in electron glasses