Transition from pure-state to mixed-state entanglement by random scattering