Switch function has little constraint in sampling

Thanks! I will try it.