-1
我有一个编码问题。我试图产生一个随机数字的8位数字,例如:12345676,显示这样的数字12 34 56 76.两个数字的数字,所以一个空格,两个数字和其他空白的数字......谢谢,如何在Xcode 7和Swift 2中创建特殊格式的随机数字
我在用的代码是:
NSMutableArray *numbers;
for(int i=0; i<3; i++){
float l_bound = 10;
float h_bound = 99;
float rndValue = (((float)arc4random()/0x100000000)*(h_bound-l_bound)+low_bound);
int intRndValue = (int)(rndValue + 0.5);
[numbers addObject: intRndValue]
;}
NSString *result = [numbers componentsJoinedByString:@" "];