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

@@ -5,10 +5,10 @@
package lp
import (
"math/rand/v2"
"testing"
"gonum.org/v1/gonum/floats/scalar"
"gonum.org/v1/gonum/internal/rand"
"gonum.org/v1/gonum/mat"
)
@@ -129,7 +129,7 @@ func TestSimplex(t *testing.T) {
testSimplex(t, test.initialBasic, test.c, test.A, test.b, convergenceTol)
}
rnd := rand.New(rand.NewSource(1))
rnd := rand.New(rand.NewPCG(1, 1))
// Randomized tests
testRandomSimplex(t, 20000, 0.2, 10, rnd)
testRandomSimplex(t, 20000, 0, 10, rnd)
@@ -140,8 +140,8 @@ func TestSimplex(t *testing.T) {
func testRandomSimplex(t *testing.T, nTest int, pZero float64, maxN int, rnd *rand.Rand) {
// Try a bunch of random LPs
for i := 0; i < nTest; i++ {
n := rnd.Intn(maxN) + 2 // n must be at least two.
m := rnd.Intn(n-1) + 1 // m must be between 1 and n
n := rnd.IntN(maxN) + 2 // n must be at least two.
m := rnd.IntN(n-1) + 1 // m must be between 1 and n
if m == 0 || n == 0 {
continue
}