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) } } }) }