switch to math/rand/v2 in most places

this allows removing some ugly instantiations of an rng based on the current
time.

Intn is now IntN for our concurrency-safe prng wrapper to match the randv2 api.

v2 exists since go1.22, which we already require.
This commit is contained in:
Mechiel Lukkien
2024-11-29 13:45:19 +01:00
parent 96a3ecd52c
commit de435fceba
9 changed files with 24 additions and 30 deletions

View File

@ -73,7 +73,7 @@ var jitterRand = mox.NewPseudoRand()
// Jitter so we don't cause load at exactly midnight, other processes may
// already be doing that.
var jitteredTimeUntil = func(t time.Time) time.Duration {
return time.Until(t.Add(time.Duration(240+jitterRand.Intn(120)) * time.Second))
return time.Until(t.Add(time.Duration(240+jitterRand.IntN(120)) * time.Second))
}
// Start launches a goroutine that wakes up just after 00:00 UTC to send TLSRPT