public void shuffle(Align algorithm, String sq1, String sq2, final int numShuffles) {

        if (monitor != null) {
            monitor.setMinimum(0);
            monitor.setMaximum(numShuffles);
        }

        float[] scores = new float[numShuffles];
        float sumScores = 0;
        for(int i = 0; i < numShuffles; i++) {
            String shuffled2 = shuffleSeq(sq2);
            algorithm.doAlignment(sq1,shuffled2);
            scores[i] = algorithm.getScore();
            sumScores += algorithm.getScore();
            final int j = i;
            if (monitor != null) {
                Runnable runnable = new Runnable() {
                    public void run() {
                        monitor.setProgress(j);
                    }
                };
                SwingUtilities.invokeLater(runnable);
            }
        }
        if (monitor != null) {
            monitor.setProgress(monitor.getMaximum());
        }

        mean = sumScores / numShuffles;
        min = Float.MAX_VALUE;
        max = -Float.MAX_VALUE;
        float sqDiffSum = 0;
        for(int i = 0; i < numShuffles; i++) {
            sqDiffSum += Math.pow(scores[i] - mean, 2);
            if (scores[i] < min) min = scores[i];
            if (scores[i] > max) max = scores[i];
        }
        variance = sqDiffSum / numShuffles;
    }