I have an array that I am randomizing. I have not been able to re-produce this, but a user of my app has reported that he experienced a situation where one of the elements of the array occurred twice and another one did not occur at all. Looking at the logic below, is there anything about it which might cause that problem in certain situations?
NSMutableArray *strArray = [NSMutableArray arrayWithCapacity:18];
[strArray addObjectsFromArray:tempNSArray];
int randomIndex, arrayCount = [strArray count];
for (int i = 0; i < arrayCount; i++) {
randomIndex = arc4random() % arrayCount;
[strArray exchangeObjectAtIndex:i withObjectAtIndex:randomIndex];
}