从数组中挑选随机NSNumber?
问题描述:
我如何选择一个随机的NSNumber含有15种不同的价格(2.25,5.99等)的阵列? 我想在稍后进行一些计算。
答
像
NSNumber *n = [theArray objectAtIndex:arc4random() % 15];