def quick_sort_random(a, left, right):
    if left < right:
        pivot = random.randint(left, right - 1)
        a[pivot], a[left] = (
            a[left],
            a[pivot],
        )  # switches the pivot with the left most bound
        pivot_index = partition(a, left, right)
        quick_sort_random(
            a, left, pivot_index
        )  # recursive quicksort to the left of the pivot point
        quick_sort_random(
            a, pivot_index + 1, right
        )  # recursive quicksort to the right of the pivot point