Monte Carlo modeling of the dual-mode regime in quantum-well and quantum-dot semiconductor lasers