Complete code for Example 3: non-uniform variate generation revisited
#include <clRNG/mrg31k3p.h>
{
cl_double output = 0.0;
for (int i = 0; i < 100; i++) {
cl_double u = clrngMrg31k3pRandomU01(stream);
}
return output;
}
int main()
{
int replications = 1024;
clrngMrg31k3pStream* stream = clrngMrg31k3pCreateStreams(NULL, 1, NULL, NULL);
cl_double sum = 0.0;
for (int i = 0; i < replications; i++)
sum += simulateOneRun(dist, stream);
printf("The average output is %.3f\n", sum / replications);
clrngMrg31k3pDestroyStreams(stream);
return 0;
}