dice.Roll()

This commit is contained in:
v2ray committed 2016-01-21 22:45:44 +01:00
1 parent d623b1809d
commit 37a9d8ef50
6 files changed
+23 -36

No files matched your search

+2 -6
View File
@@ -1,7 +1,7 @@
package vmess
import (
"math/rand"
"github.com/v2ray/v2ray-core/common/dice"
)
type UserLevel byte
@@ -39,11 +39,7 @@ func (this *User) AnyValidID() *ID {
if len(this.AlterIDs) == 0 {
return this.ID
}
if len(this.AlterIDs) == 1 {
return this.AlterIDs[0]
}
idx := rand.Intn(len(this.AlterIDs))
return this.AlterIDs[idx]
return this.AlterIDs[dice.Roll(len(this.AlterIDs))]
}
type UserSettings struct {