change the sampling with replacement to reservoir sampling