implementation for sampling /