Here's my code:
-(void)randommoves
{
NSArray *possiblemoves =[NSArray arrayWithObjects:@"R ",@"R' ",@"L ",@"L' ",@"B ",@"B' ",@"F ",@"F' ",@"U ",@"U' ",@"D ",@"D' ", nil];
NSMutableString *finalmoves = [[NSMutableString alloc] init];
finalmoves = [NSMutableString stringWithCapacity:0];
[finalmoves retain];
int i = 0;
for (i=0; i<20; i++) {
int r = rand() % 13;
NSString *string = [possiblemoves objectAtIndex:r];
[finalmoves appendString:string];
}
NSLog(@"%@",finalmoves);
[finalmoves release];
}
And every time I run it I get the EXACT same string "D' B B' D L' D' F' L' B' U' D D D' L' U R B F D' B' "
What I want it to do is give me a new move set every time I run it
I've ran this at least 30 times to make sure that it wasn't a fluke, and that it really WAS returning the same string, and sure enough, it is.