mirror of https://github.com/schollz/croc.git
add randome name
This commit is contained in:
parent
ebac8beaaa
commit
f3eb85dd95
|
@ -0,0 +1,16 @@
|
|||
package utils
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"strings"
|
||||
|
||||
"github.com/schollz/mnemonicode"
|
||||
)
|
||||
|
||||
func GetRandomName() string {
|
||||
result := []string{}
|
||||
bs := make([]byte, 4)
|
||||
rand.Read(bs)
|
||||
result = mnemonicode.EncodeWordList(result, bs)
|
||||
return strings.Join(result, "-")
|
||||
}
|
Loading…
Reference in New Issue