You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- package utils
-
- import (
- "math/rand"
- "time"
- )
-
- func RandFloats(min, max float64) float64 {
- rand.Seed(time.Now().UnixNano())
- return min + rand.Float64()*(max-min)
- }
-
- func RandInt(max int) int {
- rand.Seed(time.Now().UnixNano()) // seed后随机数可变
- return rand.Intn(max) // 0-100的随机数
- }
|