What TBlue said: The components of an NSColor
go from 0.0 to 1.0, not 0 to 255. (Also, the upper bound of arc4random_uniform()
is what the result will be less than, not what the max value of the result can be.)
- (IBAction)randomColor:(id)sender {
int size = 256;
int R = arc4random_uniform(size);
int G = arc4random_uniform(size);
int B = arc4random_uniform(size);
NSColor *newcolor = [NSColor colorWithCalibratedRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:1.0];
[self.colorwell setColor:newcolor];
}