Created
September 22, 2016 22:15
-
-
Save rymcol/48a505c2a1c874daea52a296a2687f5f to your computer and use it in GitHub Desktop.
Enables arc4random_uniform in Swift on Ubuntu, just add this to the top of your main.swift file under the rest of your imports.
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
#if os(Linux) | |
import SwiftGlibc | |
public func arc4random_uniform(_ max: UInt32) -> Int32 { | |
return (SwiftGlibc.rand() % Int32(max-1)) | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@rymcol thank you my friend for these lines. Blessings.