v2ray-core/common/dice/dice.go

18 lines
167 B
Go
Raw Normal View History

2016-01-21 21:45:44 +00:00
package dice
import (
"math/rand"
2016-01-25 10:47:22 +00:00
"time"
2016-01-21 21:45:44 +00:00
)
func Roll(n int) int {
if n == 1 {
return 0
}
return rand.Intn(n)
}
2016-01-25 10:47:22 +00:00
func init() {
rand.Seed(time.Now().Unix())
}