Skip to content

Commit

Permalink
Add rand seed in RAND(min, max) #578 (#579)
Browse files Browse the repository at this point in the history
  • Loading branch information
u5surf authored Jan 19, 2021
1 parent 526916e commit f0097e9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/runtime/core/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"math"
"math/rand"
"reflect"
"time"
)

func IsNil(input interface{}) bool {
Expand Down Expand Up @@ -46,6 +47,7 @@ func NumberLowerBoundary(input float64) float64 {
}

func Random(max float64, min float64) float64 {
rand.Seed(time.Now().UnixNano())
r := rand.Float64()
i := r * (max - min + 1)
out := math.Floor(i) + min
Expand Down

0 comments on commit f0097e9

Please sign in to comment.