mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 18:17:52 -05:00
18 lines
167 B
Go
18 lines
167 B
Go
package dice
|
|
|
|
import (
|
|
"math/rand"
|
|
"time"
|
|
)
|
|
|
|
func Roll(n int) int {
|
|
if n == 1 {
|
|
return 0
|
|
}
|
|
return rand.Intn(n)
|
|
}
|
|
|
|
func init() {
|
|
rand.Seed(time.Now().Unix())
|
|
}
|