Skip to content

Instantly share code, notes, and snippets.

@cardoso
Created May 25, 2020 01:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cardoso/76c868e707554fc653dc1aa53728deb8 to your computer and use it in GitHub Desktop.
Save cardoso/76c868e707554fc653dc1aa53728deb8 to your computer and use it in GitHub Desktop.
import Foundation
func generateUserId(length: Int = 10) -> String {
let letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
return String((0..<length).map{ _ in letters.randomElement()! })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment