public int partition(int[] arr, int start, int end){
        Random random = new Random();
        int pivotIndex = start + random.nextInt(end - start + 1);
        int pivot = arr[pivotIndex];
        swap(arr, pivotIndex, end);

        int index = start;
        for(int i = start; i <= end; i++){
            if(arr[i] < pivot){
                swap(arr, i, index++);
            }
        }
        swap(arr, index, end);
        return index;
    }