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

@ -252,7 +252,7 @@ var jitterRand = mox.NewPseudoRand()
// Jitter so we don't cause load at exactly whole hours, other processes may
// already be doing that.
var jitteredTimeUntil = func(t time.Time) time.Duration {
return time.Until(t.Add(time.Duration(30+jitterRand.Intn(60)) * time.Second))
return time.Until(t.Add(time.Duration(30+jitterRand.IntN(60)) * time.Second))
}
// Start launches a goroutine that wakes up at each whole hour (plus jitter) and