title: Getting two images to appear in random sequence iOS
body: <p>I am new to the community, so let me know if my question is unclear. I am trying to make a choice reaction exercise on the iPAD. There are two images that should appear in random sequence on the left and right of the screen, and the user will respond by tapping a button that corresponds to the position of the appeared image. Here's the problem, I tried to get the two images to appear at random order using the following way:</p>
  
  <pre><code>- (void) viewDidAppear:(BOOL)animated
  {
     for(int n = 1; n &lt;= 20; n = n + 1)
     {
        int r = arc4random() % 2;
        NSLog(@"%i", r);
        if(r==1)
        {
          [self greenCircleAppear:nil finished:nil context: nil];
        }
        else
       {
          [self redCircleAppear:nil finished:nil context: nil];
       }
    }
  }
  </code></pre>
  
  <p>However, 20 random numbers get generated while only 1 set of animation is run. Is there a way to let the animation finish running in each loop before the next loop begins? Any help is appreciated, thanks in advance!</p>