@Override
            public void run() {
                try {
                    latch.await();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                double x = 0., y = 0.;
                ThreadLocalRandom rand = ThreadLocalRandom.current();
                for (int i = offset; i < iterationsCount; i += threadsCount) {
                    x = rand.nextDouble();
                    y = rand.nextDouble();
                    double length = Math.sqrt( x * x + y * y );
                    if (length <= 1.d) {
                        localCaught++;
                    }
                }
                caughtValues.addAndGet(localCaught);
            }