Browse Source

TokenGenerator

master
Elis Axelsson 5 years ago
parent
commit
c4505e0894
  1. 20
      src/WorstCaptcha/TokenGenerator.go

20
src/WorstCaptcha/TokenGenerator.go

@ -0,0 +1,20 @@
package WorstCaptcha
import (
"math/rand"
"time"
)
func GetRandomToken() string {
rand.Seed(time.Now().UnixNano())
var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
b := make([]rune, 64)
for i := range b {
b[i] = letterRunes[rand.Intn(len(letterRunes))]
}
return string(b)
}
Loading…
Cancel
Save