The Thrust example that estimated π generated the random coordinates on the interval [0,1] by generating vectors of random integers and then dividing by the largest value produced by the random integer generator, RAND_MAX, with both operations performed on the host. This particular random number generator is exclusively a host function, so that computation needs to be done on the host. However, there is no good reason not to do the division in parallel on the device. Modify the code to generate random numbers on the host, but to do the division in parallel on the GPU, use thrust::transform with a device vector.
#Sales Offer!| Get upto 25% Off: