Convert Code loop in C

the code in VC 6 is?

int __stdcall test (int iNumber,int *iAddr)
{
//iAddr is array of int

for (int j=0; j<100; j++)	
	iAddr[j] = -1;;

srand(iNumber);

int   Num;
byte  bExist;

for (int i=0; i<iCount; i++)
{
    bExist = 0;
    while (1)
	{
	    Num = (rand())%100;
	    for (int j=0; j<i;j++)
		{
			 if (iAddr[j]==Num)
			{
				  bExist = 1;
				  break;
			}
		}
		if (bExist==0)
		{
			iAddr[i] = Num;
			break;
		}
		else
		  bExist = 0;
	} 
}

 return 0;

}

thanks

Why?

is this homework?

Post your code version first, then maybe someone can help you debug.

And use the code block thing, rather than pasting directly.

i learn GPU Programming first, i want know if this code run in GPU ,is it faster than CPU ?PC??