updated version HW3 : new sampling