ParallelRandom { public synchronized void next(Pointer<Integer> output) { CLEvent evt = doNext(); this.output.read(queue, output, true, evt); } ParallelRandom();  ParallelRandom(CLQueue queue, int parallelSize, final long seed); int nextInt(); synchronized boolean isPreload(); synchronized void setPreload(boolean preload); long nextLong(); int nextInt(int n); float nextFloat(); double nextDouble(); CLBuffer<Integer> getSeeds(); CLQueue getQueue(); int getParallelSize(); synchronized CLEvent doNext(); synchronized void next(Pointer<Integer> output); synchronized Pointer<Integer> next();  }
@Test public void testPICircle() { try { ParallelRandom random = new ParallelRandom( JavaCL.createBestContext().createDefaultQueue(), nPoints * 2, seed ); int nInside = 0, nTotalPoints = 0; for (int iLoop = 0; iLoop < nLoops; iLoop++) { Pointer<Integer> values = random.next(); for (int iPoint = 0; iPoint < nPoints; iPoint++) { int offset = iPoint * 2; int ix = values.get(offset), iy = values.get(offset + 1); float x = (float)((ix & mask) / divid); float y = (float)((iy & mask) / divid); float dist = x * x + y * y; if (dist <= 1) nInside++; } nTotalPoints += nPoints; } checkPICircleProba(nInside, nTotalPoints); } catch (Exception ex) { throw new RuntimeException(ex); } }