Simple generating of a number between 0.0 and 1.0?

Hi! I’m trying 2 days now to generate a simple random number in CUDA.
I have already search this forum and google and don’t understand how to
generate a simple random number. I know there is a SDK example “MersenneTwister”,
but this looks way to overkill for my application. I only want my kernel to generate ONE random number.
Is there any simple method to do this? It would really help me to progress.

This is what i use



	return ((z<<16)+w)*2.328306e-10f;

It is a combined MCW generator. See…arsaglia99.html

See Thrust’s monte_carlo example, which uses thrust::default_random_engine and thrust::uniform_real_distribution to produce numbers in [0.0, 1.0).

Thank you very much, Thrust was exact what I was searching for!