Code refactor

This commit is contained in:
Murat Kabilov
2017-05-12 11:37:09 +02:00
parent 0821990720
commit abb1173035
20 changed files with 788 additions and 701 deletions
+21
View File
@@ -0,0 +1,21 @@
package util
import (
"math/rand"
"time"
)
var passwordChars = []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*=")
func init() {
rand.Seed(int64(time.Now().Unix()))
}
func RandomPasswordBytes(n int) []byte {
b := make([]byte, n)
for i := range b {
b[i] = passwordChars[rand.Intn(len(passwordChars))]
}
return b
}