avoid large MIMIC stack overflow

Use non-recursive random partitioning function to avoid stack overflow
with MIMIC and large sample size.