Stochastic formation of quantum defects in carbon nanotubes