Implemented sampling until certain precision