@Test
public void testRandomizedShortSort() {

    Random rand = new Random();
    for (int k = 0; k < 100; k++) {
        double[] keys = new double[30];
        for (int i = 0; i < 10; i++) {
            keys[i] = i;
        }
        for (int i = 10; i < 20; i++) {
            keys[i] = rand.nextDouble();
        }
        for (int i = 20; i < 30; i++) {
            keys[i] = i;
        }
        double[] v0 = valuesFromKeys(keys, 0);
        double[] v1 = valuesFromKeys(keys, 1);
        Sort.sort(keys, 10, 10, v0, v1);
        checkOrder(keys, 10, 10, v0, v1);
        checkValues(keys, 0, keys.length, v0, v1);
        for (int i = 0; i < 10; i++) {
            assertEquals(i, keys[i], 0);
        }
        for (int i = 20; i < 30; i++) {
            assertEquals(i, keys[i], 0);
        }
    }
}