From ece50727f6eb26c073da26401e6d3f981aaad620 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Mon, 15 Apr 2019 20:47:16 -0400 Subject: [PATCH] math/rand is notrand. seed it with time. --- deliverator.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/deliverator.go b/deliverator.go index 7a15915..fdded08 100644 --- a/deliverator.go +++ b/deliverator.go @@ -17,10 +17,14 @@ package main import ( "log" - "math/rand" + notrand "math/rand" "time" ) +func init() { + notrand.Seed(time.Now().Unix()) +} + type Doover struct { ID int64 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) return } - drift += time.Duration(rand.Int63n(int64(drift / 10))) + drift += time.Duration(notrand.Int63n(int64(drift / 10))) when := time.Now().UTC().Add(drift) stmtAddDoover.Exec(when.Format(dbtimeformat), goarounds, username, rcpt, msg) select {