从数组中随机取出4个不重复的数字


NSMutableArray *array = [[NSMutableArray alloc]initWithObjects:@"0", @"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",nil];

for (int i = 0; i< 4; i++)

{

        int arc = arc4random() % 10;

        NSString *num = [array objectAtIndex:arc];

        [array removeObjectAtIndex:arc];

}

你可能感兴趣的:(----------,iOS,----------,iOS,方法)