1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-03-17 21:18:37 +02:00

Add rand seed in RAND(min, max) #578 (#579)

This commit is contained in:
Y.Horie 2021-01-20 05:20:41 +09:00 committed by GitHub
parent 526916efb6
commit f0097e984e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ import (
"math"
"math/rand"
"reflect"
"time"
)
func IsNil(input interface{}) bool {
@ -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