Edit: The answer linked in the comments above proposes a more elegant solution - shuffling the array in place, although it uses the same principal as my naive approach :)
If I understand you correctly: You are wanting to select all items from the range 0-9 at random.
My initial approach would be to create a bag with all the items in the range. Each time you randomly select an item - remove it from the bag so you don't select it again.
The following code snippet should achieve this:
int randomNumber;
// Fill remainingNumbers array with numbers 0-9
NSMutableArray *remainingNumbers = [NSMutableArray array];
for (int i = 0; i < 10; i++) {
[remainingNumbers addObject:[NSNumber numberWithInt:i]];
}
// Create tempNumbers array to store our random numbers in
NSMutableArray *tempNumbers = [NSMutableArray array];
for (int i = 0; i < 9; i++) {
// Create a random number in the range of the indexs for remainingNumbers array
int maxIndex = [remainingNumbers count] -1;
randomNumber = arc4random() % maxIndex;
// Add random number to tempNumbers array
[tempNumbers addObject:[remainingNumbers objectAtIndex:randomNumber]];
// Remove the number from the remaining numbers so we don't add duplicates
[remainingNumbers removeObjectAtIndex:randomNumber];
}
// Add final number
[tempNumbers addObject:[remainingNumbers objectAtIndex:0]];
// Print the array of 'randomly selected numbers'
NSLog(@"The array is: %@", tempNumbers);