double[][] lhsu(double[] xmin, double[] xmax, int nsample) {
        int nvar = xmin.length;
        double s[][] = new double[nsample][nvar];
        for (int j = 0; j < nvar; j++) {
            int[] idx = randperm(nsample);
            for (int i = 0; i < nsample; i++) {
                double P = (idx[i] - random()) / (double) nsample;
                s[i][j] = xmin[j] + P * (xmax[j] - xmin[j]);
            }
        }
        return s;
    }