Problem in using curand

I would like to get some helps from experts.

My code executes cuda kernels repeatedly and each kernel draws random numbers. Depending on an internal condition, some draw a random number once and the others twice. Is this problematic?

Below are simplified version of my kernels.
The two kernels “do_it1” and “do_it2” are mathematically equivalent.
But, it am afraid that results from the two kernels are quite different.
“do_it2” looks silly. But, should it be forbidden?

========== codes below ==========
(1) Setting up a random number generator
global void setup(curandState *state, unsigned long long seed)
{
int id = threadIdx.x + blockIdx.x * blockDim.x;
curand_init(seed, id, 0, &state[id]);
}

(2) Working kernels
global void do_it2(curandState *state)
{
int id = threadIdx.x + blockIdx.x * blockDim.x;
curandState localState = state[id];
if( curand_uniform(&localState) > 0.5 ) {
if( curand_uniform(&localState) > 0.5) {
do_something() ;
}
}
state[id] = localState;
}

global void do_it1(curandState *state)
{
int id = threadIdx.x + blockIdx.x * blockDim.x;
curandState localState = state[id];
if( curand_uniform(&localState) > 1.- 0.5 * 0.5 ) {
do_something() ;
}
state[id] = localState;
}

(3) main
int main()
{
setup<<<64, 64>>>(states, 1234);
for(i = 0; i < 100; i++) {
do_it1<<<64, 64>>>(states);
// or do_it2<<<64, 64>>>(states);
}
}

No this is not problematic:

Thank you for the comment, Robert.

I am doing a particle simulation study using CUDA. The number of particles is ~10^7 and each particle is assigned to a thread. My headache is that the two codes result in considerably different particle configurations after ~10^(5 or 6) time steps.
I need to figure out the reason for the discrepancy between the two codes.
Your answer suggests me to scrutinize other parts of the code.

Thanks!

I wouldn’t expect two realizations of a particle problem, one that retrieves a single random number per particle, and another that retrieves two random numbers per particle, to give the same results.

However there will be no particular problem with generating random numbers, whether you choose one per particle, or two per particle, as you have shown. You will get properly distributed random numbers in each case.

I will check my entire code more carefully, return back when I figure out the reason.