public class ParallelRandom extends Object
ParallelRandom r = new ParallelRandom();
r.setPreload(true); // faster
while (true) {
System.out.println(r.nextDouble());
}
next() or next(Pointer).| Constructor and Description |
|---|
ParallelRandom() |
ParallelRandom(CLQueue queue,
int parallelSize,
long seed) |
| Modifier and Type | Method and Description |
|---|---|
CLEvent |
doNext() |
int |
getParallelSize()
Number of random numbers generated at each call of
next() or next(Pointer)The numbers might not all be generated exactly in parallel, the level of parallelism is implementation-dependent. |
CLQueue |
getQueue() |
CLBuffer<Integer> |
getSeeds() |
boolean |
isPreload()
If true, a new batch of parallel random numbers is automatically precomputed in background as soon as one starts to consume numbers from the current batch (this gives faster random numbers, at the risk of computing more values than needed)
|
Pointer<Integer> |
next()
Returns a direct NIO buffer containing the next
getParallelSize() random integers. |
void |
next(Pointer<Integer> output)
Copies the next
getParallelSize() random integers in the provided output buffer |
double |
nextDouble() |
float |
nextFloat() |
int |
nextInt() |
int |
nextInt(int n) |
long |
nextLong() |
void |
setPreload(boolean preload)
If true, a new batch of parallel random numbers is automatically precomputed in background as soon as one starts to consume numbers from the current batch (this gives faster random numbers, at the risk of computing more values than needed)
|
public ParallelRandom() throws IOException
IOExceptionpublic ParallelRandom(CLQueue queue, int parallelSize, long seed) throws IOException
IOExceptionpublic int nextInt()
public boolean isPreload()
public void setPreload(boolean preload) throws CLBuildException
CLBuildExceptionpublic long nextLong()
public int nextInt(int n)
public float nextFloat()
public double nextDouble()
public int getParallelSize()
next() or next(Pointer)next()public void next(Pointer<Integer> output)
getParallelSize() random integers in the provided output bufferoutput - public Pointer<Integer> next()
getParallelSize() random integers.getParallelSize()Copyright © 2009-2015. All Rights Reserved.