neoneo-go/pkg/util/random.go

17 lines
252 B
Go
Raw Normal View History

2018-01-28 07:05:35 +00:00
package util
import (
"math/rand"
"time"
)
// RandUint32 return a random number between min and max.
func RandUint32(min, max int) uint32 {
n := min + rand.Intn(max-min)
return uint32(n)
}
func init() {
rand.Seed(time.Now().UTC().UnixNano())
}