Skip to content

Commit e8ff3dd

Browse files
committed
Update to use exp/rand
1 parent efc99bc commit e8ff3dd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

kde.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ package kde
33

44
import (
55
"math"
6-
"math/rand"
76

8-
"gonum.org/v1/gonum/stat/distuv"
7+
"golang.org/x/exp/rand"
98

109
"gonum.org/v1/gonum/floats"
1110
"gonum.org/v1/gonum/mat"
1211
"gonum.org/v1/gonum/stat"
1312
"gonum.org/v1/gonum/stat/distmv"
13+
"gonum.org/v1/gonum/stat/distuv"
1414
)
1515

1616
var sizeMismatch string = "kde: input size mismatch"
@@ -73,7 +73,7 @@ type Gaussian struct {
7373
X mat.Matrix
7474
Chol *mat.Cholesky
7575
Weights []float64
76-
Src *rand.Rand
76+
Src rand.Source
7777
}
7878

7979
func (gauss Gaussian) Dim() int {
@@ -119,7 +119,7 @@ func (gauss Gaussian) Rand(x []float64) []float64 {
119119
if gauss.Src == nil {
120120
idx = rand.Intn(n)
121121
} else {
122-
idx = gauss.Src.Intn(n)
122+
idx = rand.New(gauss.Src).Intn(n)
123123
}
124124
} else {
125125
c := distuv.NewCategorical(gauss.Weights, gauss.Src)

0 commit comments

Comments
 (0)