This question already has an answer here:
I am trying to write a raytracer accelerated with CUDA, but I need to be able to generate random numbers.
I've been searching through the internet to find a way to generate random floats on demand within device code much like the rand() function of c++ but the only possible solutions I find are separate kernel calls that generate N numbers and then get copied back to host memory, which is not a possible solution for me sadly. If anyone knows a way to make this kind of RNG work, I'd much appreciate if you share it with me.