Displaying 1 result from an estimated 1 matches for "simulc".
Did you mean:
simul
2003 Sep 24
1
Problem using C random generator called from R
...://www.opengroup.org/onlinepubs/007908799/xsh/drand48.html). When
values are returned to R, they are not in [0,1]. A simple C program using
drand48() gives values in [0,1] so I suppose there is a problem (type
definition ?) between C and R. Here are R and C function and an example.
# R function
simulC <- function(n)
{
dyn.load("test.so")
simR <- runif(n)
simC <- .C("test",
as.integer(n),
res=double(n))$res
out <- list(simR=simR,simC=simC)
out
}
// C function
void test(int *n,double *res)
{
int i;
for(i=0;i<*n;i++) {res[i] = drand48();}...