Choose pivot randomly
Choose pivot randomly

Random pivot choice solves the problem of O(n^2) running time for
already-sorted input. Now a random index in the array is chosen as
the pivot index, and the pivot is swapped with the first element
prior to the partition step. Running quicksort_test now shows
basically equivalent running times for sorted and unsorted arrays.

timpel/stanford-algs,timpel/stanford-algs