stratified resample implemented