private void generateOrderedPoints(double[] arrayX, double[] arrayY) {
        Random rand = new Random();

        // Make a number of columns
        int diff_w = Math.max(mViewWidth / mViewHeight, 1);
        int diff_h = Math.max(mViewHeight / mViewWidth, 1);
        boolean correct = false;
        int temp_col = 0;
        int temp_row = 0;
        while (!correct) {
            temp_col += diff_w;
            temp_row += diff_h;
            if (temp_col * temp_row >= mRegionsCount)
                correct = true;
        }


        // Make a number of rows
        int columns = temp_col;
        int bal = mRegionsCount % columns;
        int rows = mRegionsCount / columns;

        // Region width/height
        int reg_width = mViewWidth / columns;
        int reg_height = mViewHeight / rows;


        // Generate points
        int curX = 0;
        int curY = 0;
        int index = 0;
        for (int i = 0; i < rows; i++) {
            if (i == rows - 1 && bal > 0) {
                columns += bal;
                reg_width = mViewWidth / columns;
            }
            for (int j = 0; j < columns; j++) {
                int x1 = rand.nextInt(reg_width / 2) + curX + reg_width / 4;
                int y1 = rand.nextInt(reg_height / 2) + curY + reg_height / 4;

                arrayX[index] = x1;
                arrayY[index] = y1;
                index++;

                curX += reg_width;
            }
            curX = 0;
            curY += reg_height;
        }
    }
Set layer-type HARDWARE or SOFTWARE for the view (true/false).

@param enabled True if should be hardware acceleration, false if should be software
vorolay/src/main/java/quatja/com/vorolay/VoronoiView.java