Hi i made a random text generator using a NSMutableArray shown in the code below ( but with 200 sentences or more ). I wondered if somebody knows how to make it more random because everytime i start the app again its the same "random" order.
What could fix my problem is save it where you left off and load that sentence where you left off when you start the app again ( but i dunno how to ).
Also i would like to know how to prevent the repeating of the sentences.
Please be free to tell me if something , entirely different would be better.
Thanks in advance...
Here's the code
Code:
#import "RandomnessViewController.h"
@implementation RandomnessViewController
- (void)viewDidLoad {
allText = [[NSMutableArray alloc] init];
[allText addObject:@"one sentence"];
[allText addObject:@"another sentence"];
[allText addObject:@"and another"];
}
- (IBAction)setRandomText {
NSString *text = [allText objectAtIndex:(rand() % [allText count])];
[randomText setText:text];
}