add randome name

This commit is contained in:
Zack Scholl 2018-09-21 22:26:10 -07:00
parent ebac8beaaa
commit f3eb85dd95
1 changed files with 16 additions and 0 deletions

16
src/utils/randomname.go Normal file
View File

@ -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, "-")
}