resample function

Helper resample function found in ?sample