chore: use math/rand/v2 and Go 1.27 generic rand.N (#33055)

This commit is contained in:
andig 2026-08-21 16:33:19 +02:00 • committed by GitHub
parent 9600fc5b9f
commit 4e45dc79bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 7 deletions

View file

@ -2,7 +2,7 @@ package modbus
import (
"encoding/binary"
"math/rand"
"math/rand/v2"
"net"
"sync"
"testing"
@ -36,8 +36,8 @@ func TestConcurrentRead(t *testing.T) {
require.NoError(t, err)
for range 50 {
addr := uint16(rand.Int31n(200) + 1)
qty := uint16(rand.Int31n(32) + 1)
addr := uint16(rand.N(200) + 1)
qty := uint16(rand.N(32) + 1)
b, err := conn.ReadInputRegisters(addr, qty)
require.NoError(t, err)
@ -48,7 +48,7 @@ func TestConcurrentRead(t *testing.T) {
}
}
time.Sleep(time.Duration(rand.Int31n(1000)) * time.Microsecond)
time.Sleep(rand.N(time.Millisecond))
}
})
}