Skip to content

Commit e35baf0

Browse files
author
Michael Hoisie
committed
web.go was just using the unseeded rand.Intn(), which generates the same random numbers each time. Now it creates its own generator with the current time as a seed.
1 parent af8ff13 commit e35baf0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

web.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414
"time"
1515
)
1616

17+
var rgen = rand.New( rand.NewSource( time.Nanoseconds() ) )
18+
1719
type Conn interface {
1820
StartResponse(status int)
1921
SetHeader(hdr string, val string, unique bool)
@@ -64,7 +66,7 @@ func randomString(length int) string {
6466
var res bytes.Buffer
6567

6668
for i := 0; i < length; i++ {
67-
rnd := rand.Intn(len(pop))
69+
rnd := rgen.Intn(len(pop))
6870
res.WriteByte(pop[rnd])
6971
}
7072

0 commit comments

Comments
 (0)