init rand with time

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

No files matched your search

+5
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())
}
+1 -1
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))
}