NSMutableSet *mySet = [[NSMutableSet alloc]init];
NSArray *myArray = [[NSArray alloc]initWithObjects:@"0",@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"a",@"b",@"c",@"d",@"e",@"f",@"g",@"h",@"i",@"j",@"k",@"l",@"m",@"n",@"o", nil];
for (int i =0; i<4000; i++) {
int x1 = arc4random() % 25;
int x2 = arc4random() % 25;
int x3 = arc4random() % 25;
int x4 = arc4random() % 25;
int x5 = arc4random() % 25;
NSString *a1 = [myArray objectAtIndex:x1];
NSString *a2 = [myArray objectAtIndex:x2];
NSString *a3 = [myArray objectAtIndex:x3];
NSString *a4 = [myArray objectAtIndex:x4];
NSString *a5 = [myArray objectAtIndex:x5];
// NSLog(@"%@%@%@%@%@ \n",a1,a2,a3,a4,a5);
NSString *tempString = [NSString stringWithFormat:@"%@%@%@%@%@",a1,a2,a3,a4,a5];
[mySet addObject:tempString];
}
NSLog(@"mySet == %@",mySet);
NSLog(@"mySet.count===%ld",(unsigned long)mySet.count);
随即生成任意规则的几个字符。
猜你喜欢
转载自zhangmingwei.iteye.com/blog/1910052
今日推荐
周排行