standardize PRNG access (#1411)

* replace math/rand with tmlibs equivalent.

* update tmlibs dependency
This commit is contained in:
Thomas Corbière
2018-04-11 11:38:30 +02:00
committed by Anton Kaliaev
parent 64879c1e6a
commit ab00bf7c8b
7 changed files with 18 additions and 24 deletions

View File

@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"fmt"
"math/rand"
"net"
"net/http"
"sync"
@ -266,7 +265,7 @@ func (c *WSClient) reconnect() error {
}()
for {
jitterSeconds := time.Duration(rand.Float64() * float64(time.Second)) // 1s == (1e9 ns)
jitterSeconds := time.Duration(cmn.RandFloat64() * float64(time.Second)) // 1s == (1e9 ns)
backoffDuration := jitterSeconds + ((1 << uint(attempt)) * time.Second)
c.Logger.Info("reconnecting", "attempt", attempt+1, "backoff_duration", backoffDuration)