Skip to content

Commit

Permalink
randutil: improving comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronis committed Mar 21, 2020
1 parent 17f893f commit 504b7bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions randutil/rand.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ func moreMixedSeed() {
var b [8]byte
rand.Read(b[:])
h.Write(b[:])
// mix in the hostname
if hostname, err := os.Hostname(); err == nil {
h.Write([]byte(hostname))
}
// mix in net interfaces hw addresses (MACs etc)
if ifaces, err := net.Interfaces(); err == nil {
for _, iface := range ifaces {
h.Write(iface.HardwareAddr)
Expand Down
2 changes: 1 addition & 1 deletion randutil/rand_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (s *randutilSuite) TestRandomString(c *C) {
}

func (s *randutilSuite) TestRandomDuration(c *C) {
// ensure higherEntropySeed is done
// ensure moreMixedSeed is done
d := randutil.RandomDuration(time.Hour)
c.Check(d < time.Hour, Equals, true)

Expand Down

0 comments on commit 504b7bc

Please sign in to comment.