|
12345678910111213141516 |
- 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的随机数
- }
|