mirror of
https://github.com/gonum/gonum.git
synced 2025-10-05 23:26:52 +08:00
all: replace internal rand shim with math/rand/v2
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user