Last active
November 25, 2017 22:21
-
-
Save jakebromberg/7bbc2e3aac1dac3322ed0c52cd731320 to your computer and use it in GitHub Desktop.
Swifty wrapper around arc4random
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 Foundation | |
public extension Numeric { | |
static func arc4random() -> Self { | |
var r: Self = 0 | |
arc4random_buf(&r, Int(MemoryLayout<Self>.size)) | |
return r | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment