Implemented 'random' and 'median' value for pivot