如何在数组中获取 5 个随机字符串?我试过这个:
stringsArray = [[NSMutableArray alloc]init];
int string_lenght = 10;
NSString *symbols = @"ABCDEFGHIJKLMNOPQRSTUWXYZabcdefghijklmnopqrstuvwxyz";
NSMutableString *randomString = [NSMutableString stringWithCapacity:string_lenght];
for (int y = 0; y<5; y++) {
for (int i = 0; i<string_lenght; i++) {
[randomString appendFormat:@"%C", [symbols characterAtIndex:random()%[symbols length]]];
}
stringsArray = [NSMutableArray arrayWithObject:randomString];
}
但是在我运行这个之后,我所拥有的只是一个长的随机字符串!