mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-05-24 05:09:09 -04:00
leverage dice.Roll
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
package protocol
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"github.com/v2ray/v2ray-core/common/dice"
|
||||
"github.com/v2ray/v2ray-core/common/serial"
|
||||
)
|
||||
|
||||
@@ -21,7 +21,7 @@ func NowTime() Timestamp {
|
||||
|
||||
func NewTimestampGenerator(base Timestamp, delta int) TimestampGenerator {
|
||||
return func() Timestamp {
|
||||
rangeInDelta := rand.Intn(delta*2) - delta
|
||||
rangeInDelta := dice.Roll(delta*2) - delta
|
||||
return base + Timestamp(rangeInDelta)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user