Function to swap two phenotypes in the population array.
Function to get a random pivot between left and right for the quicksort algo.
Partition function for the quicksort algo.
Quicksort algo.