How Sampling Affects the Detectability of Machine-written texts: A Comprehensive Study