pratice code to resampling paticles