moby/utils/random.go
Guillaume J. Charmes 6998c3c387
go fmt
2013-11-07 12:27:33 -08:00

16 lines
248 B
Go

package utils
import (
"crypto/rand"
"encoding/hex"
"io"
)
func RandomString() string {
id := make([]byte, 32)
_, err := io.ReadFull(rand.Reader, id)
if err != nil {
panic(err) // This shouldn't happen
}
return hex.EncodeToString(id)
}