public Perlin(int width, int height) {
        random = new int[512];
        Random r = new Random();
        for (int i=0;i<512;i++) {
            random[i] = r.nextInt(256);
        }
        
        data = new int[width][height];
        for (int i=0;i<width;i++) {
            for (int j=0;j<height;j++) {
                data[i][j] = (int) (255*(noise(10.0*i/width,10.0*j/height,0)-1)/(2));
            }
        }
        
        double minValue = 0;
        double maxValue = 0;
        
        for (int i=0;i<width;i++) {
            for (int j=0;j<height;j++) {
                minValue = Math.min(data[i][j], minValue);
                maxValue = Math.max(data[i][j], maxValue);
            }
        }
                
        for (int i=0;i<width;i++) {
            for (int j=0;j<height;j++) {
                data[i][j] = (int) (255*(data[i][j]-minValue)/(maxValue-minValue));
            }
        }
    }