I just wrote this:
- (IBAction)weatherButtonPressed:(id)sender {
BOOL cloudy = NO;
int rando = arc4random()%101;
if (rando <= 50) {
cloudy = YES;}
else {
cloudy = NO;
}
if (cloudy) {
self.weatherLabel.text = @"no, it's cloudy.";
} else {
self.weatherLabel.text = @"yes, it's clear!";
}
NSLog(@"rando: %d", rando);
}
I know it's super sloppy. Also, I couldn't figure out how to get my random number to actually appear in my weatherLabel text next to the result of cloudy or clear. It seems like there should be a way to set the Boolean to just be random without the rando variable.