all: replace internal rand shim with math/rand/v2

This commit is contained in:
Dan Kortschak
2025-01-02 12:07:22 +10:30
parent cf3307fa63
commit bc349ecfab
345 changed files with 1165 additions and 1214 deletions

View File

@@ -6,6 +6,7 @@ package multi_test
import (
"math"
"math/rand/v2"
"testing"
"gonum.org/v1/gonum/graph"
@@ -13,7 +14,6 @@ import (
"gonum.org/v1/gonum/graph/iterator"
"gonum.org/v1/gonum/graph/multi"
"gonum.org/v1/gonum/graph/testgraph"
"gonum.org/v1/gonum/internal/rand"
)
func directedBuilder(nodes []graph.Node, edges []testgraph.WeightedLine, _, _ float64) (g graph.Graph, n []graph.Node, e []testgraph.Edge, s, a float64, ok bool) {
@@ -86,10 +86,10 @@ func TestDirected(t *testing.T) {
g.AddNode(it.Node())
}
it.Reset()
rnd := rand.New(rand.NewSource(1))
rnd := rand.New(rand.NewPCG(1, 1))
for it.Next() {
u := it.Node()
d := rnd.Intn(5)
d := rnd.IntN(5)
vit := g.Nodes()
for d >= 0 && vit.Next() {
v := vit.Node()
@@ -114,10 +114,10 @@ func TestDirected(t *testing.T) {
}
it.Reset()
var lines []graph.Line
rnd := rand.New(rand.NewSource(1))
rnd := rand.New(rand.NewPCG(1, 1))
for it.Next() {
u := it.Node()
d := rnd.Intn(5)
d := rnd.IntN(5)
vit := g.Nodes()
for d >= 0 && vit.Next() {
v := vit.Node()