Selecting random numbers iphone sdk
- by harekam_taj
Hey,
I want to select 10 random numbers from 1 to 35.
I am trying to do the following, but I get some repeated numbers
int totalNumberCnt = 1;
while (totalNumberCnt < 11) {
int randomNumber1 = 1 + arc4random() % 35;
NSString *numberString = [NSString stringWithFormat: @"%d",randomNumber1];
NSLog(numberString);
[firstNumber addObject:numberString];
[secondNumber addObject:numberString];
totalNumberCnt++;
}
Thank you for your help.