CUDPP problems cudaGetLastError says invalid argument, while CUDPPResult says No erro

Hi.
I need random numbers in cuda, so I wantet to try out CUDPP.
But when I run the code below, I get

cudppRand - No error

Cuda error detected in cudppRand invalid argument. Quitting.

If I put the cudaError_t err = cudaGetLastError(); before cudppRand
function It dosen’t catch the error. so It have to come from that
there. Obviously something is done wrong, but I can’t figure out how
to debug this when it says that cudpp says ok, and cuda says no no.

Anyone have a clue?

Anders

ps. I’ve put more code on [url=“http://pastebin.com/VHCpFQc5”]http://pastebin.com/VHCpFQc5[/url] if that helps

CUDPPResult resultRand = cudppRand(randPlan, random_out, numElements);

switch( resultRand ){
case CUDPP_SUCCESS:
printf(“cudppRand - No error\n”);
break;

   case CUDPP_ERROR_INVALID_HANDLE:
           printf("cudppRand - Specified handle (for example, to a plan) is

invalid.\n");
break;

   case CUDPP_ERROR_ILLEGAL_CONFIGURATION:
           printf("cudppRand - Specified configuration is illegal. For example,

an invalid or illogical combination of options.\n");
break;

   case CUDPP_ERROR_UNKNOWN :
           printf("cudppRand - Unknown or untraceable error.\n");
           break;

}

cudaError_t err = cudaGetLastError();
if( err != cudaSuccess ){
printf(“\nCuda error detected in cudppRand %s. Quitting.\n”,
cudaGetErrorString(err) ); fflush(stdout);
exit(1);
}