go(algo): seed prng with "time.Now().UnixNano()"
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
11719bc5fa
commit
26065d3f10
|
@ -7,9 +7,11 @@
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.dotya.ml/wanderer/math-optim/bench"
|
"git.dotya.ml/wanderer/math-optim/bench"
|
||||||
"git.dotya.ml/wanderer/math-optim/stats"
|
"git.dotya.ml/wanderer/math-optim/stats"
|
||||||
|
"golang.org/x/exp/rand"
|
||||||
"gonum.org/v1/gonum/stat/distuv"
|
"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)
|
vals := make([]float64, dimens)
|
||||||
|
|
||||||
// create a continuous uniform distribution representation within min/max bounds
|
// 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)
|
genValsRandomSearch(dimens, vals, &uniformDist)
|
||||||
|
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -3,6 +3,7 @@ module git.dotya.ml/wanderer/math-optim
|
||||||
go 1.18
|
go 1.18
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3
|
||||||
gonum.org/v1/gonum v0.11.0
|
gonum.org/v1/gonum v0.11.0
|
||||||
gonum.org/v1/plot v0.10.1
|
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-latex/latex v0.0.0-20210823091927-c0d11ff05a81 // indirect
|
||||||
github.com/go-pdf/fpdf v0.6.0 // indirect
|
github.com/go-pdf/fpdf v0.6.0 // indirect
|
||||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // 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/image v0.0.0-20220302094943-723b81ca9867 // indirect
|
||||||
golang.org/x/text v0.3.7 // indirect
|
golang.org/x/text v0.3.7 // indirect
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue