change the computation method to make the sampling stable, add time test (debug)