goProject/.svn/pristine/99/991138d5da7bf4ff94fe15d1c7a6915f9430cf80.svn-base

48 lines
721 B
Plaintext
Raw Normal View History

2025-01-06 16:21:36 +08:00
package mathUtil
import (
"testing"
)
func TestGetSafeRandProccess(t *testing.T) {
// r := GetSafeRand()
// for {
// go r.Int()
// go r.Intn(10)
// go r.Int31()
// go r.Int31n(10)
// go r.Int63()
// go r.Int63n(10)
// go r.Float64()
// go r.Float32()
// }
// r1 := GetRand()
// for {
// go r1.Int()
// }
}
func BenchmarkInt(b *testing.B) {
r := GetSafeRand()
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
r.Int()
}
})
}
func BenchmarkGetRandNumList(b *testing.B) {
r := GetSafeRand()
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
_, err := r.GetRandNumList(1, 10000, 10, true)
if err != nil {
b.Error(err)
}
}
})
}