add function of sampling
add function of sampling