开发者

random number sqlite iphone

I'm trying to get a random number and match it up with a sqlite row. So far I have:

number = (arc4random()%8)+1;
NSString *string = [NSString stringWithFormat:@"%i",number];
_label.text = string;

I'm confused on how I take this random number and match it with sqlite? I'm trying to display "recipe.name". Also, how could I inc开发者_JS百科orporate "count" into this so that it limits the random number by the number of rows in the sqlite table?

Thanks in advance!


You can use the following method to do that

int randumNumber = RandomNumber() % numberOFRows;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜