mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/decimal: use consistent randomizer in tests
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3683
This commit is contained in:
parent
0a4d8dc777
commit
a11dc6689a
2 changed files with 6 additions and 3 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}()
|
||||
|
|
Loading…
Reference in a new issue