8 #include "../_internal/shared.cuh" 10 __device__
int RNG::ApproxRandBinomHelper(
unsigned int i,
float mean,
float var,
float N){
11 if(mean <= RNG_MEAN_BOUNDARY_NORM){
12 if(N < RNG_N_BOUNDARY_POIS_BINOM){
return binomcdfinv(uint_float_01(i), mean, mean/N, N); }
else{
return poiscdfinv(uint_float_01(i), mean); }
14 else if(mean >= N-RNG_MEAN_BOUNDARY_NORM){
15 if(N < RNG_N_BOUNDARY_POIS_BINOM){
return N - binomcdfinv(uint_float_01(i), N-mean, (N-mean)/N, N); }
else{
return N - poiscdfinv(uint_float_01(i), N-mean); }
17 return round(normcdfinv(uint_float_01(i))*sqrtf(var)+mean);