go(algo): seed prng with "time.Now().UnixNano()"
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2022-07-05 21:46:09 +02:00
parent 11719bc5fa
commit 26065d3f10
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
2 changed files with 8 additions and 2 deletions

View File

@ -7,9 +7,11 @@
"fmt"
"log"
"os"
"time"
"git.dotya.ml/wanderer/math-optim/bench"
"git.dotya.ml/wanderer/math-optim/stats"
"golang.org/x/exp/rand"
"gonum.org/v1/gonum/stat/distuv"
)
@ -52,7 +54,11 @@ func singleRandomSearch(dimens uint, f func([]float64) float64, min, max float64
vals := make([]float64, dimens)
// create a continuous uniform distribution representation within min/max bounds
uniformDist := distuv.Uniform{Min: min, Max: max}
uniformDist := distuv.Uniform{
Min: min,
Max: max,
Src: rand.NewSource(uint64(time.Now().UnixNano())),
}
genValsRandomSearch(dimens, vals, &uniformDist)

2
go.mod
View File

@ -3,6 +3,7 @@ module git.dotya.ml/wanderer/math-optim
go 1.18
require (
golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3
gonum.org/v1/gonum v0.11.0
gonum.org/v1/plot v0.10.1
)
@ -14,7 +15,6 @@ require (
github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81 // indirect
github.com/go-pdf/fpdf v0.6.0 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3 // indirect
golang.org/x/image v0.0.0-20220302094943-723b81ca9867 // indirect
golang.org/x/text v0.3.7 // indirect
)