void shuffle (card_t cards[], card_t cards2[], char *bitvec)
{
int i;
unsigned char temp, r;
srand(time(NULL));
for (i = 0; i < 52; i++)
{
r = rand() % 52;
temp = bitvec[r/8];
if (!(temp & (1 << (8- (r % 8)))))
{
temp |= (1 << (8- (r % 8)));------->is this my problem?
}
}
}
ok so I am trying to use a bit vector to keep track of some random numbers and I suppose I just dont understand how to use bit operations verry well since i thought that this code would work but from the results i have been getting the bit just stays 0 no matter what. So i want to check and see if the bit is 0 and if it is i want to set it to one but either my check or set of the bit isnt wokring. if anyone would please tell me what im doing wrong i would appreciate it.