title: Null output troubles
body: <p>Okay I've been trying at this for about 2-3 hours now and I don't seem to quite get it. Here is the code and a brief explanation:
  I'm trying to make two lists of words, pull one word from each of those lists at random, and display both words (along with a third) on the screen when a button is pressed. Here is the code:     </p>
  
  <pre><code>   #import "Project001ViewController.h"
  
      @implementation Project001ViewController
  
      -(ArrayOfWords *) advs
      {
          if(!advs){
              advs = [[ArrayOfWords alloc] init];
              NSString* advpath = @"/WordLists/adverbs.txt";
              NSLog(@"1");
              [[self advs] populateListOfWords:advpath];
          }
          return advs;
      }
  
  
      -(ArrayOfWords *) adjs
      {
          if (!adjs) {
              adjs = [[ArrayOfWords alloc] init];
              NSString* adjpath = @"/WordLists/adjectives.txt";
              [[self adjs] populateListOfWords:adjpath];
              NSLog(@"2");
          }
          return adjs;
      }
  
  
      - (IBAction)generate:(UIButton *)sender;
      {
          //int randy = arc4random() % 11;
          //NSNumber* num= [NSNumber numberWithInteger:randy];
  
  
          NSString* obj = @"app";
          NSString* adverb = [[self advs] randomItem];
          NSString* adjective = [[self adjs] randomItem];
          NSLog(@"%i   %i",[adjs size],[advs size]);
  
  
  
          NSLog(@"1 %@ %@ %@.",adverb, adjective, obj);
          //NSLog(@"%@",thePhrase);
          [display setText:@"Hi"];
      }
  
  
      @end
  </code></pre>
  
  <p>I'm having trouble on the last <code>NSLog</code> line:</p>
  
  <pre><code> NSString* obj = @"app";
          NSString* adverb = [[self advs] randomItem];
          NSString* adjective = [[self adjs] randomItem];
          NSLog(@"%i   %i",[adjs size],[advs size]);
          NSLog(@"1 %@ %@ %@.",adverb, adjective, obj);
  </code></pre>
  
  <p>Instead of getting the two randomly selected words (using <code>arc4random()</code> to produce them) the array returns <code>Null</code>. But I know FOR CERTAIN. That the array's are not empty because the <code>NSLog</code> Line where I print <code>[adjs size]</code> and <code>[advs size]</code> I get the correct sizes of the list of words. I just want to know what is causing them to print <code>Null</code> here.</p>
  
  <p>populateListOfWords, randomItem, and size methods:</p>
  
  <pre><code>- (NSArray *) populateListOfWords:(NSString *) path {
  
      //gets the components of the file into an NSString
      NSString *wordListString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
      //returns an array of all the words (uses the next line indicator '\n' to know when it's at the end of the word
      NSArray* words = [wordListString componentsSeparatedByString:@"\n"];
  
      length=(NSNumber*)([words count]);
      return words;
  
    }
  
  
  -(NSString*) randomItem{
      //returns random object in list
      return (NSString*)[list objectAtIndex:(arc4random() % (int)length)] ;
  
  }
  
  -(int) size{
      //returns size of list
      return (int)length;
  }
  </code></pre>
  
  <p>(If more code is needed let me know and thank you in advanced for any and all help).</p>