mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-08 18:46:36 +02:00
Code refactor
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user