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

        int i = 0;
        while (i < mRegionsCount) {
            int x1 = rand.nextInt(mViewWidth + 1);
            int y1 = rand.nextInt(mViewHeight + 1);

            boolean good = true;
            for (int j = 0; j < arrayX.length; j++) {
                double x2 = arrayX[j];
                double y2 = arrayY[j];

                double dist = Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
                if (dist < mDistanceBetweenSites)
                    good = false;
            }

            if (good) {
                arrayX[i] = x1;
                arrayY[i] = y1;
                i++;
            }
        }
    }
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