mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
trie: remove deprecated uses of math.rand (#1136)
This commit is contained in:
parent
416c5cb7dd
commit
8ba50ab2aa
2 changed files with 5 additions and 3 deletions
|
|
@ -18,6 +18,7 @@ package trie
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
crand "crypto/rand"
|
||||
"encoding/hex"
|
||||
"math/rand"
|
||||
"testing"
|
||||
|
|
@ -97,7 +98,7 @@ func TestHexToCompactInPlaceRandom(t *testing.T) {
|
|||
for i := 0; i < 10000; i++ {
|
||||
l := rand.Intn(128)
|
||||
key := make([]byte, l)
|
||||
rand.Read(key)
|
||||
crand.Read(key)
|
||||
hexBytes := keybytesToHex(key)
|
||||
hexOrig := []byte(string(hexBytes))
|
||||
exp := hexToCompact(hexBytes)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package trie
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
crand "crypto/rand"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
|
@ -835,8 +836,8 @@ func TestDecodeNode(t *testing.T) {
|
|||
elems = make([]byte, 20)
|
||||
)
|
||||
for i := 0; i < 5000000; i++ {
|
||||
rand.Read(hash)
|
||||
rand.Read(elems)
|
||||
crand.Read(hash)
|
||||
crand.Read(elems)
|
||||
decodeNode(hash, elems)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue