Dynamics of phase-locking random lasers