private void initPerlin1() {
        p = new int[B + B + 2];
        g3 = new float[B + B + 2][3];
        g2 = new float[B + B + 2][2];
        g1 = new float[B + B + 2];
        int i, j, k;

        for (i = 0; i < B; i++) {
            p[i] = i;

            g1[i] = (float) (((Math.random() * Integer.MAX_VALUE) % (B + B)) - B) / B;

            for (j = 0; j < 2; j++)
                g2[i][j] = (float) (((Math.random() * Integer.MAX_VALUE) % (B + B)) - B) / B;
            normalize2(g2[i]);

            for (j = 0; j < 3; j++)
                g3[i][j] = (float) (((Math.random() * Integer.MAX_VALUE) % (B + B)) - B) / B;
            normalize3(g3[i]);
        }

        while (--i > 0) {
            k = p[i];
            j = (int) ((Math.random() * Integer.MAX_VALUE) % B);
            p[i] = p[j];
            p[j] = k;
        }

        for (i = 0; i < B + 2; i++) {
            p[B + i] = p[i];
            g1[B + i] = g1[i];
            for (j = 0; j < 2; j++)
                g2[B + i][j] = g2[i][j];
            for (j = 0; j < 3; j++)
                g3[B + i][j] = g3[i][j];
        }
    }