mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-03 20:39:36 +08:00
21 lines
333 B
Go
21 lines
333 B
Go
|
package funcutil
|
||
|
|
||
|
import (
|
||
|
"math/rand"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
rand.Seed(time.Now().UnixNano())
|
||
|
}
|
||
|
|
||
|
var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
||
|
|
||
|
func RandomString(n int) string {
|
||
|
b := make([]rune, n)
|
||
|
for i := range b {
|
||
|
b[i] = letterRunes[rand.Intn(len(letterRunes))]
|
||
|
}
|
||
|
return string(b)
|
||
|
}
|