diff --git a/lib/decimal/decimal_test.go b/lib/decimal/decimal_test.go index 4e2e271ef..4bc74130e 100644 --- a/lib/decimal/decimal_test.go +++ b/lib/decimal/decimal_test.go @@ -506,8 +506,9 @@ func TestFloatToDecimalRoundtrip(t *testing.T) { f(vMin) f(vStaleNaN) + r := rand.New(rand.NewSource(1)) for i := 0; i < 1e4; i++ { - v := rand.NormFloat64() + v := r.NormFloat64() f(v) f(v * 1e-6) f(v * 1e6) diff --git a/lib/decimal/decimal_timing_test.go b/lib/decimal/decimal_timing_test.go index ceba29d2f..b7d451bb4 100644 --- a/lib/decimal/decimal_timing_test.go +++ b/lib/decimal/decimal_timing_test.go @@ -84,17 +84,19 @@ func benchmarkAppendFloatToDecimal(b *testing.B, fa []float64) { } var testFAReal = func() []float64 { + r := rand.New(rand.NewSource(1)) fa := make([]float64, 8*1024) for i := 0; i < len(fa); i++ { - fa[i] = rand.NormFloat64() * 1e-6 + fa[i] = r.NormFloat64() * 1e-6 } return fa }() var testFAInteger = func() []float64 { + r := rand.New(rand.NewSource(2)) fa := make([]float64, 8*1024) for i := 0; i < len(fa); i++ { - fa[i] = float64(int(rand.NormFloat64() * 1e6)) + fa[i] = float64(int(r.NormFloat64() * 1e6)) } return fa }()