// A test of the QuickSort function in the Sort module

use Sort;
use Random;

config const size = 4096;

def main() {
  var A: [1..size] int;
  var rands: [1..size] real;
  var randomStream = RandomStream();

  // Fill A with random int values in [0, 99999]
  randomStream.fillRandom(rands);
  [i in 1..size] A(i) = (100000 * rands(i)):int;

  QuickSort(A);

  // Check that A is sorted
  [i in 1..size-1] {
    if A(i) > A(i+1) then
      writeln(A(i), " ", A(i+1));
  }
}


Make the seed to the RandomStream class in my QuickSort test be set to something that causes the "infinite" loop failure instead of the current time.
// A test of the QuickSort function in the Sort module

use Sort;
use Random;

config const size = 4096;
config const seed = 27;

def main() {
  var A: [1..size] int;
  var rands: [1..size] real;
  var randomStream = RandomStream(seed);

  // Fill A with random int values in [0, 99999]
  randomStream.fillRandom(rands);
  [i in 1..size] A(i) = (100000 * rands(i)):int;

  QuickSort(A);

  // Check that A is sorted
  [i in 1..size-1] {
    if A(i) > A(i+1) then
      writeln(A(i), " ", A(i+1));
  }
}