diff --git a/g/util/grand/grand.go b/g/util/grand/grand.go index ed492f6ea..d74cbc653 100644 --- a/g/util/grand/grand.go +++ b/g/util/grand/grand.go @@ -19,9 +19,9 @@ func Meet(num, total int) bool { return Rand(0, total) <= num } -// 随机计算是否满足给定的概率(float64) -func MeetProb(prob float64) bool { - return Rand(0, 1e17) <= int(prob*1e17) +// 随机计算是否满足给定的概率(float32) +func MeetProb(prob float32) bool { + return Rand(0, 1e7) <= int(prob*1e7) } // Rand 别名 diff --git a/geg/other/test2.go b/geg/other/test2.go index 65b39b5ea..9bc299382 100644 --- a/geg/other/test2.go +++ b/geg/other/test2.go @@ -1,15 +1,9 @@ package main import ( - "gitee.com/johng/gf/g/os/gcron" - "gitee.com/johng/gf/g/os/glog" - "time" + "fmt" ) func main() { - gcron.AddSingleton("* * * * * *", func() { - glog.Println("doing") - time.Sleep(2*time.Second) - }) - select { } + fmt.Println(float32(10)/3) } \ No newline at end of file