how to use rendom number generation in kernel

Ok ive got to write a program which uses genetic algoritm on GPU.

The first major obstacle ive encountered, that stopped my work was to use of random function.

In normal program i would use rand(), and that would be all. In this case lets say i need something like this:

int chance = rnd_int(0,10); //just my function that generates a random number between 0 and 10

		if(chance < 5)




Ok heres my question, what to do in CUDA? How to replace rand(); in kernel?

Read about CURAND library.