-
-
Save xta/08a343c05fef58df2b38 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
class AppDelegate: NSObject, NSApplicationDelegate { | |
@IBOutlet var window: NSWindow | |
@IBOutlet var label: NSTextField | |
func applicationDidFinishLaunching(aNotification: NSNotification?) { | |
// Insert code here to initialize your application | |
} | |
func applicationWillTerminate(aNotification: NSNotification?) { | |
// Insert code here to tear down your application | |
} | |
@IBAction func seed(sender: AnyObject) { | |
srandom(CUnsignedInt(time(nil))); | |
label.stringValue = "Seed" | |
} | |
@IBAction func generate(sender: AnyObject) { | |
var generated = (random() % 100) + 1 | |
label.stringValue = "Generated \(generated)" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment