mirror of
https://github.com/bloeys/nset.git
synced 2025-12-29 06:28:19 +00:00
Replace deprecated rand.Seed
This commit is contained in:
32
nset_test.go
32
nset_test.go
@ -195,7 +195,7 @@ func BenchmarkNSetAddRand(b *testing.B) {
|
|||||||
|
|
||||||
n := nset.NewNSet[uint32]()
|
n := nset.NewNSet[uint32]()
|
||||||
|
|
||||||
rand.Seed(RandSeed)
|
rand := rand.New(rand.NewSource(RandSeed))
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
n.Add(rand.Uint32() % maxBenchSize)
|
n.Add(rand.Uint32() % maxBenchSize)
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ func BenchmarkNSetAddRandNoSizeLimit(b *testing.B) {
|
|||||||
|
|
||||||
n := nset.NewNSet[uint32]()
|
n := nset.NewNSet[uint32]()
|
||||||
|
|
||||||
rand.Seed(RandSeed)
|
rand := rand.New(rand.NewSource(RandSeed))
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
n.Add(rand.Uint32())
|
n.Add(rand.Uint32())
|
||||||
}
|
}
|
||||||
@ -215,7 +215,7 @@ func BenchmarkMapAddRand(b *testing.B) {
|
|||||||
|
|
||||||
hMap := map[uint32]struct{}{}
|
hMap := map[uint32]struct{}{}
|
||||||
|
|
||||||
rand.Seed(RandSeed)
|
rand := rand.New(rand.NewSource(RandSeed))
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
hMap[rand.Uint32()%maxBenchSize] = struct{}{}
|
hMap[rand.Uint32()%maxBenchSize] = struct{}{}
|
||||||
}
|
}
|
||||||
@ -278,7 +278,7 @@ func BenchmarkNSetContainsRand(b *testing.B) {
|
|||||||
|
|
||||||
//Work
|
//Work
|
||||||
found := 0
|
found := 0
|
||||||
rand.Seed(RandSeed)
|
rand := rand.New(rand.NewSource(RandSeed))
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
|
|
||||||
randVal := rand.Uint32()
|
randVal := rand.Uint32()
|
||||||
@ -311,7 +311,7 @@ func BenchmarkNSetContainsRandFullRange(b *testing.B) {
|
|||||||
|
|
||||||
//Work
|
//Work
|
||||||
found := 0
|
found := 0
|
||||||
rand.Seed(RandSeed)
|
rand := rand.New(rand.NewSource(RandSeed))
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
|
|
||||||
randVal := rand.Uint32()
|
randVal := rand.Uint32()
|
||||||
@ -336,7 +336,7 @@ func BenchmarkMapContainsRand(b *testing.B) {
|
|||||||
|
|
||||||
//Work
|
//Work
|
||||||
found := 0
|
found := 0
|
||||||
rand.Seed(RandSeed)
|
rand := rand.New(rand.NewSource(RandSeed))
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
|
|
||||||
randVal := rand.Uint32()
|
randVal := rand.Uint32()
|
||||||
@ -394,7 +394,7 @@ func BenchmarkNSetDeleteRand(b *testing.B) {
|
|||||||
b.StartTimer()
|
b.StartTimer()
|
||||||
|
|
||||||
//Work
|
//Work
|
||||||
rand.Seed(RandSeed)
|
rand := rand.New(rand.NewSource(RandSeed))
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
|
|
||||||
randVal := rand.Uint32()
|
randVal := rand.Uint32()
|
||||||
@ -414,7 +414,7 @@ func BenchmarkMapDeleteRand(b *testing.B) {
|
|||||||
b.StartTimer()
|
b.StartTimer()
|
||||||
|
|
||||||
//Work
|
//Work
|
||||||
rand.Seed(RandSeed)
|
rand := rand.New(rand.NewSource(RandSeed))
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
|
|
||||||
randVal := rand.Uint32()
|
randVal := rand.Uint32()
|
||||||
@ -473,7 +473,7 @@ func BenchmarkNSetIsEqRand(b *testing.B) {
|
|||||||
|
|
||||||
b.StopTimer()
|
b.StopTimer()
|
||||||
|
|
||||||
rand.Seed(RandSeed)
|
rand := rand.New(rand.NewSource(RandSeed))
|
||||||
s1 := nset.NewNSet[uint32]()
|
s1 := nset.NewNSet[uint32]()
|
||||||
s2 := nset.NewNSet[uint32]()
|
s2 := nset.NewNSet[uint32]()
|
||||||
for i := uint32(0); i < maxBenchSize; i++ {
|
for i := uint32(0); i < maxBenchSize; i++ {
|
||||||
@ -492,7 +492,7 @@ func BenchmarkMapIsEqRand(b *testing.B) {
|
|||||||
|
|
||||||
b.StopTimer()
|
b.StopTimer()
|
||||||
|
|
||||||
rand.Seed(RandSeed)
|
rand := rand.New(rand.NewSource(RandSeed))
|
||||||
m1 := map[uint32]struct{}{}
|
m1 := map[uint32]struct{}{}
|
||||||
m2 := map[uint32]struct{}{}
|
m2 := map[uint32]struct{}{}
|
||||||
for i := uint32(0); i < maxBenchSize; i++ {
|
for i := uint32(0); i < maxBenchSize; i++ {
|
||||||
@ -526,7 +526,7 @@ func BenchmarkNSetIsEqRand100Mil(b *testing.B) {
|
|||||||
|
|
||||||
b.StopTimer()
|
b.StopTimer()
|
||||||
|
|
||||||
rand.Seed(RandSeed)
|
rand := rand.New(rand.NewSource(RandSeed))
|
||||||
s1 := nset.NewNSet[uint32]()
|
s1 := nset.NewNSet[uint32]()
|
||||||
s2 := nset.NewNSet[uint32]()
|
s2 := nset.NewNSet[uint32]()
|
||||||
for i := uint32(0); i < 100_000_000; i++ {
|
for i := uint32(0); i < 100_000_000; i++ {
|
||||||
@ -545,7 +545,7 @@ func BenchmarkMapIsEqRand100Mil(b *testing.B) {
|
|||||||
|
|
||||||
b.StopTimer()
|
b.StopTimer()
|
||||||
|
|
||||||
rand.Seed(RandSeed)
|
rand := rand.New(rand.NewSource(RandSeed))
|
||||||
m1 := map[uint32]struct{}{}
|
m1 := map[uint32]struct{}{}
|
||||||
m2 := map[uint32]struct{}{}
|
m2 := map[uint32]struct{}{}
|
||||||
for i := uint32(0); i < 100_000_000; i++ {
|
for i := uint32(0); i < 100_000_000; i++ {
|
||||||
@ -628,7 +628,7 @@ func BenchmarkNSetGetIntersectionRand(b *testing.B) {
|
|||||||
|
|
||||||
b.StopTimer()
|
b.StopTimer()
|
||||||
|
|
||||||
rand.Seed(RandSeed)
|
rand := rand.New(rand.NewSource(RandSeed))
|
||||||
|
|
||||||
s1 := nset.NewNSet[uint32]()
|
s1 := nset.NewNSet[uint32]()
|
||||||
s2 := nset.NewNSet[uint32]()
|
s2 := nset.NewNSet[uint32]()
|
||||||
@ -649,7 +649,7 @@ func BenchmarkMapGetIntersectionRand(b *testing.B) {
|
|||||||
|
|
||||||
b.StopTimer()
|
b.StopTimer()
|
||||||
|
|
||||||
rand.Seed(RandSeed)
|
rand := rand.New(rand.NewSource(RandSeed))
|
||||||
|
|
||||||
m1 := map[uint32]struct{}{}
|
m1 := map[uint32]struct{}{}
|
||||||
m2 := map[uint32]struct{}{}
|
m2 := map[uint32]struct{}{}
|
||||||
@ -731,7 +731,7 @@ func BenchmarkNSetGetAllElementsRand(b *testing.B) {
|
|||||||
|
|
||||||
b.StopTimer()
|
b.StopTimer()
|
||||||
|
|
||||||
rand.Seed(RandSeed)
|
rand := rand.New(rand.NewSource(RandSeed))
|
||||||
s1 := nset.NewNSet[uint32]()
|
s1 := nset.NewNSet[uint32]()
|
||||||
for i := uint32(0); i < maxBenchSize; i++ {
|
for i := uint32(0); i < maxBenchSize; i++ {
|
||||||
s1.Add(rand.Uint32())
|
s1.Add(rand.Uint32())
|
||||||
@ -750,7 +750,7 @@ func BenchmarkMapGetAllElementsRand(b *testing.B) {
|
|||||||
|
|
||||||
b.StopTimer()
|
b.StopTimer()
|
||||||
|
|
||||||
rand.Seed(RandSeed)
|
rand := rand.New(rand.NewSource(RandSeed))
|
||||||
|
|
||||||
m1 := map[uint32]struct{}{}
|
m1 := map[uint32]struct{}{}
|
||||||
for i := uint32(0); i < maxBenchSize; i++ {
|
for i := uint32(0); i < maxBenchSize; i++ {
|
||||||
|
|||||||
Reference in New Issue
Block a user