math/rand is notrand. seed it with time.

This commit is contained in:
Ted Unangst 2019-04-15 20:47:16 -04:00
parent 2a06f69aa0
commit ece50727f6
1 changed files with 6 additions and 2 deletions

View File

@ -17,10 +17,14 @@ package main
import ( import (
"log" "log"
"math/rand" notrand "math/rand"
"time" "time"
) )
func init() {
notrand.Seed(time.Now().Unix())
}
type Doover struct { type Doover struct {
ID int64 ID int64
When time.Time When time.Time
@ -41,7 +45,7 @@ func sayitagain(goarounds int, username string, rcpt string, msg []byte) {
log.Printf("he's dead jim: %s", rcpt) log.Printf("he's dead jim: %s", rcpt)
return return
} }
drift += time.Duration(rand.Int63n(int64(drift / 10))) drift += time.Duration(notrand.Int63n(int64(drift / 10)))
when := time.Now().UTC().Add(drift) when := time.Now().UTC().Add(drift)
stmtAddDoover.Exec(when.Format(dbtimeformat), goarounds, username, rcpt, msg) stmtAddDoover.Exec(when.Format(dbtimeformat), goarounds, username, rcpt, msg)
select { select {