Correction to pick_random_sn function.