github.com/nalind/docker@v1.5.0/utils/random.go (about)

     1  package utils
     2  
     3  import (
     4  	"crypto/rand"
     5  	"encoding/hex"
     6  	"io"
     7  )
     8  
     9  func RandomString() string {
    10  	id := make([]byte, 32)
    11  
    12  	if _, err := io.ReadFull(rand.Reader, id); err != nil {
    13  		panic(err) // This shouldn't happen
    14  	}
    15  	return hex.EncodeToString(id)
    16  }