NSArray *pro = @[@(0.60),@(0.29),@(0.88),@(1),@(0),@(0.5),@(0.15)];
NSMutableArray *randPro = [NSMutableArray array];
while ([randPro count] < 1) {
int r = arc4random() % [pro count];
[randPro addObject:[pro objectAtIndex:r]];
}
NSArray *pro = @[@(0.60),@(0.29),@(0.88),@(1),@(0),@(0.5),@(0.15)];
NSMutableArray *randPro = [NSMutableArray array];
while ([randPro count] < 1) {
int r = arc4random() % [pro count];
[randPro addObject:[pro objectAtIndex:r]];
}
本文标题:OC 数组中随机取出一个数
本文链接:https://www.haomeiwen.com/subject/lsfgmftx.html
网友评论