Skip to content
Prev 18634 / 63424 Next

R binomial RNG stuck at 1 via Fortran call

Hi, 

I have some trouble with the result of a fortran function calling the R
binomial RNG:

The C function rbinom is wrapped as in the file attached.

My main fortran program starts as
call rndstart()

and ends as
call rndend()  

I happen to call the binomial RNG within a loop as 

b = ggrbinom(1.d0,0.5d0)
write(*,*) 'b=',b 

In certain cases, after a few iterations in the loop,
b get stuck at 1

Any hint to explain that would help.

Gilles