moving random.go from utils

Closes #10962
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
This commit is contained in:
Srini Brahmaroutu 2015-02-25 18:27:14 +00:00
parent c9b4e665f9
commit 38752a5727
2 changed files with 68 additions and 0 deletions

View file

@ -36,3 +36,12 @@ func GenerateRandomID() string {
return value
}
}
func RandomString() string {
id := make([]byte, 32)
if _, err := io.ReadFull(rand.Reader, id); err != nil {
panic(err) // This shouldn't happen
}
return hex.EncodeToString(id)
}