Added a function for a random pivot