Moving to the OptiX forum.
I’m assuming optim6.5 means OptiX SDK 6.5.0.
As mentioned inside your other thread, OptiX SDK 6.5.0 is considered legacy and shouldn’t be used for current GPU ray tracing developments anymore because there are already nine newer OptiX SDK releases (7.0.0 to 7.7.0 and 8.0.0) with a more modern and a lot faster OptiX API which should be used instead.
The topic of (pseudo-) random number generators (RNG) is a very wide and complicated field of research.
There are various methods to implement RNGs with different quality for image synthesis and of course those can be implemented in CUDA C++ as well.
One of the simplest and fastest (and worst quality) is a Linear Congruential Generator (LCG) which is just multiplying an unsigned integer number with a big prime number and adds another big prime number.
https://en.wikipedia.org/wiki/Linear_congruential_generator
Examples of that can be found inside the OptiX SDK (the optixPathTracer example needs it), or here:
https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/MDL_renderer/shaders/random_number_generators.h#L62
Since you usually need a floating point random number in the open interval range [0.0, 1.0) and there are only 23 mantissa bits inside the IEEE 754 32bit floating point, some there are effectively only 2^23 different values in that range possible. (There are other ways to get the random bits into that mantissa than a slow floating point division.)
Then you also need to break up the correlation of random numbers between pixels, which is usually done with a seed generated from a hash or encryption algorithm of the linear pixel index.
https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/MDL_renderer/shaders/random_number_generators.h#L37
https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/MDL_renderer/shaders/raygeneration.cu#L346
A totally different method to break up such correlations is Blue Noise Dithering.
Another very simple RNG is Additive Recurrence which is just adding an irrational number to a float and takes the fractional part with fmodf(value, 1.0f)
If you want to delve into that random number generator topic more, learn what Low Discrepancy Sequences are because those are usually used for image synthesis because they have better stratified distributions than simple white noise sampling of the LCG:
https://en.wikipedia.org/wiki/Low-discrepancy_sequence
Note that the same advanced OptiX examples are also showing how to importance-sample the bi-directional scattering distribution functions and area light sources.