public static int partition(int[] arr, int start, int end){
        Random random = new Random();
        int pivotIndex = start + random.nextInt(end - start + 1);
        swap(arr, pivotIndex, end);
        int pivot = arr[end];
        int i = start, j = start;
        while(j < end){
            if(arr[j] < pivot){
                swap(arr, j, i);
                i++;
            }
            j++;
        }
        swap(arr, i, end);
        return i;
    }