我希望它不断生成不同的随机数。如何使用 While 语句?
int randomnumber = (arc4random() % 188)+1;
if ([myArray containsObject:[NSNumber numberWithInt:randomnumber]])
{
NSLog(@"Yes, they are the same");
randomnumber = (arc4random() % 188)+1;
}
else
{
NSLog(@"No, they are not the same");
}
[myArray addObject:[NSNumber numberWithInt:randomnumber]];