Picks a random pivot element between l and r and partitions arr [ l . . r ] around the randomly picked element using partition ( )
int randomPartition ( int arr [ ] , int l , int r ) { int n = r - l + 1 ; int pivot = rand ( ) % n ; swap ( & arr [ l + pivot ] , & arr [ r ] ) ; return Partition ( arr , l , r ) ; }