A very quick and effective way to assure you have a list of unique numbers is like this...
Code:
// card shuffle demonstration
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#define RANDS 52
int main (void)
{
int Nums[RANDS]; // the array
int item = 0; // swaps
int temp;
int idx = 0; // loops
srand(time(NULL));
// fill the array
for (idx = 0; idx < RANDS; idx++)
Nums[idx] = idx + 1;
// unshuffled array
for (idx = 0; idx < RANDS; idx++)
printf("[%d] = %d \t", idx, Nums[idx]);
// shuffle the array
for (idx = RANDS - 1; idx > 0; idx--)
{ item = rand() % idx;
temp = Nums[idx];
Nums[idx] = Nums[item];
Nums[item] = temp; }
// shuffled array
printf("\n\n");
for (idx = 0; idx < RANDS; idx++)
printf("[%d] = %d \t", idx, Nums[idx]);
printf("\n\nPress Enter to exit...");
getchar();
return 0;
}
Now be smart and don't even think about scoop and poop coding with this example. Study it to learn how it works then WRITE YOUR OWN CODE... (Most schools will check forums like this one and you will just get nailed for cheating.)