How to use NSIndexSet
it would be the proper way: NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 3)]; or you can use the NSMutableIndexSet for the random indexes: NSMutableIndexSet *mutableIndexSet = [[NSMutableIndexSet alloc] init]; [mutableIndexSet addIndex:0]; [mutableIndexSet addIndex:2]; [mutableIndexSet addIndex:9]; etc.