NSArray *temp = [NSArray arrayWithObjects:@"1", @"2", @"3", @"4", @"5", @"6", nil];
NSMutableArray *tempArray = [[NSMutableArray alloc] initWithArray:temp];
NSMutableArray *resultArray = [[NSMutableArray alloc] init];
int i;
int count = temp.count;
for (i = 0; i < count; i ++) {
int index = arc4random() % (count - i);
[resultArray addObject:[tempArray objectAtIndex:index]];
[tempArray removeObjectAtIndex:index];
}
[tempArray release];
NSLog(@"resultArray is %@",resultArray);
NSLog(@"看看结果楼");