1
0
mirror of https://github.com/fluencelabs/tendermint synced 2025-06-26 03:01:42 +00:00

Switch usage of math/rand to cmn's rand ()

This commit switches all usage of math/rand to cmn's rand. The only
exceptions are within the random file itself, the tools package, and the
crypto package. In tools you don't want it to lock between the go-routines.
The crypto package doesn't use it so the crypto package have no other
dependencies within tendermint/tendermint for easier portability.

Crypto/rand usage is unadjusted.

Closes 
This commit is contained in:
Dev Ojha
2018-07-16 00:20:37 -07:00
committed by Anton Kaliaev
parent 14cebd181d
commit dae7dc30e0
10 changed files with 32 additions and 37 deletions

@ -6,7 +6,6 @@ import (
crand "crypto/rand"
"encoding/json"
"fmt"
"math/rand"
"net/http"
"os"
"os/exec"
@ -206,7 +205,7 @@ func testWithHTTPClient(t *testing.T, cl client.HTTPClient) {
require.Nil(t, err)
assert.Equal(t, got3, val3)
val4 := rand.Intn(10000)
val4 := cmn.RandIntn(10000)
got4, err := echoIntViaHTTP(cl, val4)
require.Nil(t, err)
assert.Equal(t, got4, val4)
@ -370,7 +369,7 @@ func TestWSClientPingPong(t *testing.T) {
}
func randBytes(t *testing.T) []byte {
n := rand.Intn(10) + 2
n := cmn.RandIntn(10) + 2
buf := make([]byte, n)
_, err := crand.Read(buf)
require.Nil(t, err)