title: change window background color
body: <p>I want to change the background color of my window every second so here is my code:</p>
  
  <pre><code>- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
  {
      [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(newColor) userInfo:nil repeats:YES];
  }
  
  -(void)newColor {
      int r;
      r = (arc4random()%250)+1;
      NSLog(@"%i", r);
  
      int g;
      g = (arc4random()%250)+1;
      NSLog(@"%i", g);
  
      int b;
      b = (arc4random()%250)+1;
      NSLog(@"%i", b);
  
      NSColor *theColor = [NSColor colorWithDeviceRed:(int)r green:(int)g blue:(int)b alpha:(float)1.0];
      [_window setBackgroundColor:theColor];
  }
  </code></pre>
  
  <p>I think my problem is in defining the colors with the variables, but I'm not sure.</p>