here is the code "itmp " will be repeat;
does any one have some good idear to make rand number which will not repeat?
//ibegin the begin number
// inumber how long the data is
// ikeepNumber choose rand number to keep and keep number is ikeepnumber
extern “C” global
void value_randkeep(
int ibegin,int inumber,int ikeepNumber, int out,int * indx
)
{
int i = blockIdx.xblockDim.x + threadIdx.x;
if(i<ikeepNumber)
{
unsigned int seed = i;
curandState s; // seed a random number generator curand_init(seed, 0, 0, &s);
curandStateXORWOW_t state;
curand_init(seed, i, 0, &state);
unsigned int irand = curand (&state );
// unsigned int irand = cuRand();
int itmp = irand%inumber;
printf("rand; %d ;%d\n",irand,itmp);
int ind = indx[itmp+ibegin];
out[ind]=0;
}