Hello,
This is my first mac app, works like a charm (as i got it from a book) just want to add a little functionality to it... but dont know how (problem with learning by myself and a book is cant really ask the "instructor" if i want to add something
)
Heres the code that i am using:
Heres what i want to do, in the text where it says Generator seeded, i want to add the srandom number as well.
I know it must be simple, but since this is my first app im just getting used to the basics.
Thanks!
This is my first mac app, works like a charm (as i got it from a book) just want to add a little functionality to it... but dont know how (problem with learning by myself and a book is cant really ask the "instructor" if i want to add something
Heres the code that i am using:
#import "Foo.h"
@implementation Foo
- (IBAction)generateid)sender
{
// Generate a number between 1 and 100 inclusive
int generated;
generated = (random() % 100) + 1;
NSLog(@"generated = %d", generated);
// Ask the text field to change what it is displaying
[textField setIntValue:generated];
}
- (IBAction)seedid)sender
{
// Seed the random number generator with the time
srandom(time(NULL));
[textField setStringValue"Generator seeded"];
}
@end
Heres what i want to do, in the text where it says Generator seeded, i want to add the srandom number as well.
I know it must be simple, but since this is my first app im just getting used to the basics.
Thanks!