I need some random numbers in my C program. Here a small example:

////////////////////////////////////////////////////////////////////////////////
#include <R.h>

void rand (int* n)
{
  int len = *n;
  for (int i = 0; i < len; i++)
    Rprintf("%1.5f ", unif_rand());
}

dyn.load("rand.dll")
.C("rand", as.integer(10))
dyn.unload("rand.dll")
////////////////////////////////////////////////////////////////////////////////

But this gives me 10 times the number 0.00000 (I need 10 numbers between 0
and 1). Can somebody give me a hint what I'm doing wrong (or misunderstand).

Thanks in advance

Thomas

	[[alternative HTML version deleted]]


