From b653adda399f06550ece7dd71a19f347007b9a75 Mon Sep 17 00:00:00 2001 From: Carlos Salguero Date: Sun, 13 Oct 2019 23:23:28 -0300 Subject: [PATCH] Fixed max value for decimal type --- internal/getters/decimal.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/getters/decimal.go b/internal/getters/decimal.go index f11a7ac..7906efa 100644 --- a/internal/getters/decimal.go +++ b/internal/getters/decimal.go @@ -2,7 +2,6 @@ package getters import ( "fmt" - "math" "math/rand" ) @@ -14,7 +13,11 @@ type RandomDecimal struct { } func (r *RandomDecimal) Value() interface{} { - f := rand.Float64() * float64(rand.Int63n(int64(math.Pow10(int(r.size))))) + size := r.size + if size > 10 { + size = 10 + } + f := rand.Float64() * float64(rand.Int63n(int64(size))) return f }