I'm working on an assignment I have seen on here, but after I have reviewed them, I still can't seem to see what I am doing wrong. My code to quicksort an array of strings seems to work - most of the time. But if I run it a number of times, it will sometimes come out with the wrong output. Any advice on where I should look to fix this would be greatly appreciated..

```
import java.util.Random;
public class QuickSortStrings {

    static String[] strings;

    public static void main(String[] args) {

        strings = new String[args.length];

        for (int i = 0; i < args.length; i++) {
            strings[i] = args[i];
        }

        qsort(0, strings.length-1);

        System.out.print("The array, quicksorted: ");
        for (int i = 0; i < strings.length; i++)
        {
            System.out.print(strings[i] + " ");
        }
        System.out.println("\n");
    }

    static void qsort(int low, int high) {
        int i = low, j = high;

        // Get the pivot element
        Random r = new Random();
        int pivot = r.nextInt(high-low+1)+low;

        // Divide into two lists
        while (i <= j) {

          while (strings[i].compareTo(strings[pivot]) < 0) i++;

          while (strings[j].compareTo(strings[pivot]) > 0) j--;

          if (i <= j) {
            exchange(i, j);
            i++;
            j--;
          }
        }

        // Recursion
        if (low < j) qsort(low, j);
        if (i < high) qsort(i, high);
      }

    static void exchange(int i, int j) {
        String temp = strings[i];
        strings[i] = strings[j];
        strings[j] = temp;
    }
}

```