public int[] generateSamplingLoop(int[] A, int m) {
        if (A == null || A.length < m || m <= 0) {
            return A;
        }
        int[] subSet = new int[m];
        for (int i = 0; i < m; i++) {
            subSet[i] = A[i];
        }
        for (int i = m; i < A.length; i++) {
            int randomIndex = new Random().nextInt(i + 1);
            if (randomIndex < m) {
                subSet[randomIndex] = A[i];
            }
        }
        return subSet;
    }