获取随机数

[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)));

}

posted @ 2015-12-10 11:47  莫莫smile1  阅读(114)  评论(0编辑  收藏  举报