Created
May 10, 2019 04:12
-
-
Save bulatie/656e26222796af39c16653a011527899 to your computer and use it in GitHub Desktop.
generate token
This file contains hidden or 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
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