Answers for "create random string in swift"

1

random string swift

func randomString(of length: Int) -> String {
    let letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    var s = ""
    for _ in 0 ..< length {
        s.append(letters.randomElement()!)
    }
    return s
}
Posted by: Guest on June-13-2020

Code answers related to "Swift"

Browse Popular Code Answers by Language