mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/uint64set: use repeatable randomizer in tests
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3683
This commit is contained in:
parent
3d1cb011b6
commit
0a4d8dc777
1 changed files with 5 additions and 4 deletions
|
@ -177,13 +177,13 @@ func TestSetOps(t *testing.T) {
|
|||
}
|
||||
f(a, b)
|
||||
|
||||
rng := rand.New(rand.NewSource(0))
|
||||
r := rand.New(rand.NewSource(1))
|
||||
for i := 0; i < 10; i++ {
|
||||
a = nil
|
||||
b = nil
|
||||
for j := 0; j < 1000; j++ {
|
||||
a = append(a, uint64(rng.Intn(1e6)))
|
||||
b = append(b, uint64(rng.Intn(1e6)))
|
||||
a = append(a, uint64(r.Intn(1e6)))
|
||||
b = append(b, uint64(r.Intn(1e6)))
|
||||
}
|
||||
f(a, b)
|
||||
}
|
||||
|
@ -608,10 +608,11 @@ func TestSetSparseItems(t *testing.T) {
|
|||
}
|
||||
|
||||
func testSetSparseItems(t *testing.T, itemsCount int) {
|
||||
r := rand.New(rand.NewSource(1))
|
||||
var s Set
|
||||
m := make(map[uint64]bool)
|
||||
for i := 0; i < itemsCount; i++ {
|
||||
x := rand.Uint64()
|
||||
x := r.Uint64()
|
||||
s.Add(x)
|
||||
m[x] = true
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue