Include error in randomness failure panic

This commit is contained in:
Jakob Borg 2014-12-08 19:40:38 +01:00
parent 957643f523
commit c96c78892d

View File

@ -49,9 +49,9 @@ func randomString(l int) string {
// randomInt64 returns a strongly random int64, slowly
func randomInt64() int64 {
var bs [8]byte
n, err := io.ReadFull(cryptoRand.Reader, bs[:])
if n != 8 || err != nil {
panic("randomness failure")
_, err := io.ReadFull(cryptoRand.Reader, bs[:])
if err != nil {
panic("randomness failure: " + err.Error())
}
return seedFromBytes(bs[:])
}