diff options
author | Tamir Duberstein <tamird@google.com> | 2021-05-25 11:38:33 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-05-25 11:41:18 -0700 |
commit | b8052176db03f5d357ca50adf1e90cfecccbc001 (patch) | |
tree | e326b95b9306b41fa7b0e6e8b11b6b80bd737a6f /pkg/tcpip/stack/nud.go | |
parent | 090ee43a1ced12d2f55e00dcd01813a4f3ea1ae5 (diff) |
Use the stack RNG
Remove redundant interface.
PiperOrigin-RevId: 375756254
Diffstat (limited to 'pkg/tcpip/stack/nud.go')
-rw-r--r-- | pkg/tcpip/stack/nud.go | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/pkg/tcpip/stack/nud.go b/pkg/tcpip/stack/nud.go index 02f905351..dac94cbe4 100644 --- a/pkg/tcpip/stack/nud.go +++ b/pkg/tcpip/stack/nud.go @@ -16,6 +16,7 @@ package stack import ( "math" + "math/rand" "sync" "time" @@ -313,15 +314,9 @@ func calcMaxRandomFactor(minRandomFactor float32) float32 { return defaultMaxRandomFactor } -// A Rand is a source of random numbers. -type Rand interface { - // Float32 returns, as a float32, a pseudo-random number in [0.0,1.0). - Float32() float32 -} - // NUDState stores states needed for calculating reachable time. type NUDState struct { - rng Rand + rng *rand.Rand mu struct { sync.RWMutex @@ -342,7 +337,7 @@ type NUDState struct { // NewNUDState returns new NUDState using c as configuration and the specified // random number generator for use in recomputing ReachableTime. -func NewNUDState(c NUDConfigurations, rng Rand) *NUDState { +func NewNUDState(c NUDConfigurations, rng *rand.Rand) *NUDState { s := &NUDState{ rng: rng, } |