all: use math/rand/v2 more

Updates #11058

Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
Maisem Ali
2024-06-05 14:37:31 -07:00
committed by Maisem Ali
parent d2d459d442
commit 4a8cb1d9f3
23 changed files with 43 additions and 66 deletions

View File

@@ -6,7 +6,7 @@ package backoff
import (
"context"
"math/rand"
"math/rand/v2"
"time"
"tailscale.com/tstime"

View File

@@ -12,7 +12,7 @@ import (
"fmt"
"io"
"log"
mrand "math/rand"
mrand "math/rand/v2"
"net/http"
"net/netip"
"os"
@@ -435,7 +435,7 @@ func (l *Logger) uploading(ctx context.Context) {
// Sleep for the specified retryAfter period,
// otherwise default to some random value.
if retryAfter <= 0 {
retryAfter = time.Duration(30+mrand.Intn(30)) * time.Second
retryAfter = mrand.N(30*time.Second) + 30*time.Second
}
tstime.Sleep(ctx, retryAfter)
} else {