added a randomized partition