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;
精彩评论