1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-06 09:15:37 -05:00

init rand with time

This commit is contained in:
Darien Raymond
2016-01-25 10:47:22 +00:00
parent b6e23de0d3
commit 1a10f7c4da
2 changed files with 6 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ package dice
import (
"math/rand"
"time"
)
func Roll(n int) int {
@@ -10,3 +11,7 @@ func Roll(n int) int {
}
return rand.Intn(n)
}
func init() {
rand.Seed(time.Now().Unix())
}

View File

@@ -6,5 +6,5 @@ import (
)
func PickPort() v2net.Port {
return v2net.Port(30000 + dice.Roll(10000))
return v2net.Port(30000 + dice.Roll(5000))
}