add non-negative check in generateSplits method