1 Star 0 Fork 0

vitarch / goutils

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
sleep.go 526 Bytes
一键复制 编辑 原始数据 按行查看 历史
vitarch 提交于 2023-06-15 11:14 . init
package utilsTime
import (
"math/rand"
"time"
)
func SleepHour() {
time.Sleep(time.Hour)
}
func SleepSecond(sleep int) {
time.Sleep(time.Duration(sleep) * time.Second)
}
func SleepRandSecond(max int, seed int64) {
//为保证不同应用程序间不会冲突,睡眠一个随机时间
rand.Seed(seed)
sleep := rand.Intn(max)
time.Sleep(time.Duration(sleep) * time.Second)
}
func SleepRandMilli(max int, seed int64) {
rand.Seed(seed)
sleep := rand.Intn(max)
time.Sleep(time.Duration(sleep) * time.Millisecond)
}
Go
1
https://gitee.com/vitarch/goutils.git
git@gitee.com:vitarch/goutils.git
vitarch
goutils
goutils
7ec6a993d123

搜索帮助