mirror of https://github.com/v2ray/v2ray-core
init rand with time
parent
b6e23de0d3
commit
1a10f7c4da
|
@ -2,6 +2,7 @@ package dice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Roll(n int) int {
|
func Roll(n int) int {
|
||||||
|
@ -10,3 +11,7 @@ func Roll(n int) int {
|
||||||
}
|
}
|
||||||
return rand.Intn(n)
|
return rand.Intn(n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
rand.Seed(time.Now().Unix())
|
||||||
|
}
|
||||||
|
|
|
@ -6,5 +6,5 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func PickPort() v2net.Port {
|
func PickPort() v2net.Port {
|
||||||
return v2net.Port(30000 + dice.Roll(10000))
|
return v2net.Port(30000 + dice.Roll(5000))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue