码迷,mamicode.com
首页 > 其他好文 > 详细

获取随机数

时间:2015-12-10 12:52:36      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:

[NSTimer scheduledTimerWithTimeInterval:[self getRandomNumber:1 to:8] target:self selector:@selector(handleTimer:) userInfo:nil repeats:YES];

//获取随机数

-(int)getRandomNumber:(int)from to:(int)to

 

{

    return (int)(from + (arc4random() % (to - from + 1)));

}

获取随机数

标签:

原文地址:http://www.cnblogs.com/momosmile/p/5035474.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!