mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +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 (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
crand "crypto/rand"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
@ -97,7 +98,7 @@ func TestHexToCompactInPlaceRandom(t *testing.T) {
|
||||||
for i := 0; i < 10000; i++ {
|
for i := 0; i < 10000; i++ {
|
||||||
l := rand.Intn(128)
|
l := rand.Intn(128)
|
||||||
key := make([]byte, l)
|
key := make([]byte, l)
|
||||||
rand.Read(key)
|
crand.Read(key)
|
||||||
hexBytes := keybytesToHex(key)
|
hexBytes := keybytesToHex(key)
|
||||||
hexOrig := []byte(string(hexBytes))
|
hexOrig := []byte(string(hexBytes))
|
||||||
exp := hexToCompact(hexBytes)
|
exp := hexToCompact(hexBytes)
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ package trie
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
crand "crypto/rand"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
@ -835,8 +836,8 @@ func TestDecodeNode(t *testing.T) {
|
||||||
elems = make([]byte, 20)
|
elems = make([]byte, 20)
|
||||||
)
|
)
|
||||||
for i := 0; i < 5000000; i++ {
|
for i := 0; i < 5000000; i++ {
|
||||||
rand.Read(hash)
|
crand.Read(hash)
|
||||||
rand.Read(elems)
|
crand.Read(elems)
|
||||||
decodeNode(hash, elems)
|
decodeNode(hash, elems)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue