Skip to content

Instantly share code, notes, and snippets.

@bulatie
Created May 10, 2019 04:12
Show Gist options
  • Save bulatie/656e26222796af39c16653a011527899 to your computer and use it in GitHub Desktop.
Save bulatie/656e26222796af39c16653a011527899 to your computer and use it in GitHub Desktop.
generate token
func generateToken() string {
var length int = 25
var seed []string = strings.Split("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", "")
var token string = ""
for i := 0; i < length; i++ {
rand.Seed(time.Now().UTC().UnixNano())
index := rand.Intn(length - 1 + 10)
token = token + seed[index]
}
return token
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment