Last active
October 15, 2016 09:17
-
-
Save bananafish911/a6a2a62e2ebef7f42eb07938e3f672c7 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
extension String { | |
///For placeholders | |
static func randomAlphaNumericString(length: Int) -> String { | |
let charactersString = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" | |
let charactersArray : [Character] = Array(charactersString.characters) | |
var string = "" | |
for _ in 0..<length { | |
string.append(charactersArray[Int(arc4random()) % charactersArray.count]) | |
} | |
return string | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment