Hide unnecessary code and random for sample permuting